summaryrefslogtreecommitdiff
path: root/libpod/container_internal_linux.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-08-05 16:11:50 +0200
committerGitHub <noreply@github.com>2019-08-05 16:11:50 +0200
commit337358ae63f5b6c5f73ee399918aa4b7c8059f85 (patch)
tree3643893b3e1f53f282cd0f42f3b1d30eec47cf1e /libpod/container_internal_linux.go
parentfff496436e89a290fd37b357419fd0f072ad5e88 (diff)
parentc23b92b4090d1aab96ddde2c897db8869eb6261e (diff)
downloadpodman-337358ae63f5b6c5f73ee399918aa4b7c8059f85.tar.gz
podman-337358ae63f5b6c5f73ee399918aa4b7c8059f85.tar.bz2
podman-337358ae63f5b6c5f73ee399918aa4b7c8059f85.zip
Merge pull request #3690 from adrianreber/ignore-static-ip
restore: added --ignore-static-ip option
Diffstat (limited to 'libpod/container_internal_linux.go')
-rw-r--r--libpod/container_internal_linux.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index 57c2854ea..d06c19b8c 100644
--- a/libpod/container_internal_linux.go
+++ b/libpod/container_internal_linux.go
@@ -752,6 +752,14 @@ func (c *Container) restore(ctx context.Context, options ContainerCheckpointOpti
return err
}
+ // If a container is restored multiple times from an exported checkpoint with
+ // the help of '--import --name', the restore will fail if during 'podman run'
+ // a static container IP was set with '--ip'. The user can tell the restore
+ // process to ignore the static IP with '--ignore-static-ip'
+ if options.IgnoreStaticIP {
+ c.config.StaticIP = nil
+ }
+
// Read network configuration from checkpoint
// Currently only one interface with one IP is supported.
networkStatusFile, err := os.Open(filepath.Join(c.bundlePath(), "network.status"))
@@ -761,7 +769,7 @@ func (c *Container) restore(ctx context.Context, options ContainerCheckpointOpti
// TODO: This implicit restoring with or without IP depending on an
// unrelated restore parameter (--name) does not seem like the
// best solution.
- if err == nil && options.Name == "" {
+ if err == nil && options.Name == "" && !options.IgnoreStaticIP {
// The file with the network.status does exist. Let's restore the
// container with the same IP address as during checkpointing.
defer networkStatusFile.Close()