diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2020-05-29 10:35:22 +0200 |
---|---|---|
committer | Valentin Rothberg <rothberg@redhat.com> | 2020-06-11 11:01:13 +0200 |
commit | cf89bb671184e453c4ba5f27e26d02216d8fc491 (patch) | |
tree | ed707e35dcae297a60e97150bc407d9a5ea5ff80 /cmd/podman/common/specgen.go | |
parent | 7d71d24440afbf30689c53c2c69205072e4b029f (diff) | |
download | podman-cf89bb671184e453c4ba5f27e26d02216d8fc491.tar.gz podman-cf89bb671184e453c4ba5f27e26d02216d8fc491.tar.bz2 podman-cf89bb671184e453c4ba5f27e26d02216d8fc491.zip |
container-{create,run}: add `--pod-id-file`
Allow containers to join an existing pod via the `--pod-id-file` which
is already supported by a number of `podman-pod` subcommands. Also add
tests to make sure it's working and to prevent future regressions.
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'cmd/podman/common/specgen.go')
-rw-r--r-- | cmd/podman/common/specgen.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/cmd/podman/common/specgen.go b/cmd/podman/common/specgen.go index 2286e67de..fee9d8c7b 100644 --- a/cmd/podman/common/specgen.go +++ b/cmd/podman/common/specgen.go @@ -254,6 +254,17 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string s.PublishExposedPorts = c.PublishAll s.Pod = c.Pod + if len(c.PodIDFile) > 0 { + if len(s.Pod) > 0 { + return errors.New("Cannot specify both --pod and --pod-id-file") + } + podID, err := ReadPodIDFile(c.PodIDFile) + if err != nil { + return err + } + s.Pod = podID + } + expose, err := createExpose(c.Expose) if err != nil { return err |