mirror of
https://github.com/containers/podman.git
synced 2025-06-27 13:38:49 +08:00
Merge pull request #2272 from adrianreber/migration
Add support to migrate containers
This commit is contained in:
@ -38,6 +38,12 @@ image contains established TCP connections, this options is required during
|
||||
restore. Defaults to not checkpointing containers with established TCP
|
||||
connections.
|
||||
|
||||
**--export, -e**
|
||||
|
||||
Export the checkpoint to a tar.gz file. The exported checkpoint can be used
|
||||
to import the container on another system and thus enabling container live
|
||||
migration.
|
||||
|
||||
## EXAMPLE
|
||||
|
||||
podman container checkpoint mywebserver
|
||||
|
@ -42,6 +42,24 @@ If the checkpoint image does not contain established TCP connections this
|
||||
option is ignored. Defaults to not restoring containers with established TCP
|
||||
connections.
|
||||
|
||||
**--import, -i**
|
||||
|
||||
Import a checkpoint tar.gz file, which was exported by Podman. This can be used
|
||||
to import a checkpointed container from another host. It is not necessary to specify
|
||||
a container when restoring from an exported checkpoint.
|
||||
|
||||
**--name, -n**
|
||||
|
||||
This is only available in combination with **--import, -i**. If a container is restored
|
||||
from a checkpoint tar.gz file it is possible to rename it with **--name, -n**. This
|
||||
way it is possible to restore a container from a checkpoint multiple times with different
|
||||
names.
|
||||
|
||||
If the **--name, -n** option is used, Podman will not attempt to assign the same IP
|
||||
address to the container it was using before checkpointing as each IP address can only
|
||||
be used once and the restored container will have another IP address. This also means
|
||||
that **--name, -n** cannot be used in combination with **--tcp-established**.
|
||||
|
||||
## EXAMPLE
|
||||
|
||||
podman container restore mywebserver
|
||||
|
@ -96,6 +96,28 @@ After being restored, the container will answer requests again as it did before
|
||||
curl http://<IP_address>:8080
|
||||
```
|
||||
|
||||
### Migrate the container
|
||||
To live migrate a container from one host to another the container is checkpointed on the source
|
||||
system of the migration, transferred to the destination system and then restored on the destination
|
||||
system. When transferring the checkpoint, it is possible to specify an output-file.
|
||||
|
||||
On the source system:
|
||||
```console
|
||||
sudo podman container checkpoint <container_id> -e /tmp/checkpoint.tar.gz
|
||||
scp /tmp/checkpoint.tar.gz <destination_system>:/tmp
|
||||
```
|
||||
|
||||
On the destination system:
|
||||
```console
|
||||
sudo podman container restore -i /tmp/checkpoint.tar.gz
|
||||
```
|
||||
|
||||
After being restored, the container will answer requests again as it did before checkpointing. This
|
||||
time the container will continue to run on the destination system.
|
||||
```console
|
||||
curl http://<IP_address>:8080
|
||||
```
|
||||
|
||||
### Stopping the container
|
||||
To stop the httpd container:
|
||||
```console
|
||||
|
Reference in New Issue
Block a user