summaryrefslogtreecommitdiff
path: root/cmd/podman/common
diff options
context:
space:
mode:
authorAdrian Reber <areber@redhat.com>2021-05-18 11:31:30 +0000
committerAdrian Reber <adrian@lisas.de>2021-06-04 13:29:02 +0200
commit1ac9198d75cb94bfdc61beb0c74cb7f90504da60 (patch)
tree16d783cedbcb85c35c3790dd68a0d1717dfde5fd /cmd/podman/common
parentf7233a2da7fe79075ade9f34adc702c5d2eb76bc (diff)
downloadpodman-1ac9198d75cb94bfdc61beb0c74cb7f90504da60.tar.gz
podman-1ac9198d75cb94bfdc61beb0c74cb7f90504da60.tar.bz2
podman-1ac9198d75cb94bfdc61beb0c74cb7f90504da60.zip
Allow changing of port forward rules on restore
Restored containers, until now, had the same port mappings as the original started container. This commit adds the parameter '--publish' to 'podman container restore' with the same semantic as during create/run. With this change it is possible to create a copy from a container with a '--publish' rule and replace the original '--publish' setting with a new one. # podman run -p 2345:8080 container # podman container checkpoint -l --export=dump.tar # podman container restore -p 5432:8080 --import=dump.tar The restored container will now listen on localhost:5432 instead of localhost:2345 as the original created container. Signed-off-by: Adrian Reber <areber@redhat.com>
Diffstat (limited to 'cmd/podman/common')
-rw-r--r--cmd/podman/common/netflags.go2
-rw-r--r--cmd/podman/common/util.go4
2 files changed, 3 insertions, 3 deletions
diff --git a/cmd/podman/common/netflags.go b/cmd/podman/common/netflags.go
index 4f634f355..78cfe2f13 100644
--- a/cmd/podman/common/netflags.go
+++ b/cmd/podman/common/netflags.go
@@ -170,7 +170,7 @@ func NetFlagsToNetOptions(cmd *cobra.Command, netnsFromConfig bool) (*entities.N
return nil, err
}
if len(inputPorts) > 0 {
- opts.PublishPorts, err = createPortBindings(inputPorts)
+ opts.PublishPorts, err = CreatePortBindings(inputPorts)
if err != nil {
return nil, err
}
diff --git a/cmd/podman/common/util.go b/cmd/podman/common/util.go
index afee55914..6a0af4dff 100644
--- a/cmd/podman/common/util.go
+++ b/cmd/podman/common/util.go
@@ -89,8 +89,8 @@ func createExpose(expose []string) (map[uint16]string, error) {
return toReturn, nil
}
-// createPortBindings iterates ports mappings into SpecGen format.
-func createPortBindings(ports []string) ([]specgen.PortMapping, error) {
+// CreatePortBindings iterates ports mappings into SpecGen format.
+func CreatePortBindings(ports []string) ([]specgen.PortMapping, error) {
// --publish is formatted as follows:
// [[hostip:]hostport[-endPort]:]containerport[-endPort][/protocol]
toReturn := make([]specgen.PortMapping, 0, len(ports))