diff options
Diffstat (limited to 'pkg/domain')
-rw-r--r-- | pkg/domain/entities/containers.go | 1 | ||||
-rw-r--r-- | pkg/domain/infra/abi/containers.go | 7 | ||||
-rw-r--r-- | pkg/domain/infra/tunnel/containers.go | 6 |
3 files changed, 14 insertions, 0 deletions
diff --git a/pkg/domain/entities/containers.go b/pkg/domain/entities/containers.go index 46b169284..3fd7c79f4 100644 --- a/pkg/domain/entities/containers.go +++ b/pkg/domain/entities/containers.go @@ -294,6 +294,7 @@ type ContainerListOptions struct { // ContainerRunOptions describes the options needed // to run a container from the CLI type ContainerRunOptions struct { + CIDFile string Detach bool DetachKeys string ErrorStream *os.File diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go index 60dbbce6c..98b886845 100644 --- a/pkg/domain/infra/abi/containers.go +++ b/pkg/domain/infra/abi/containers.go @@ -29,6 +29,7 @@ import ( "github.com/containers/podman/v2/pkg/signal" "github.com/containers/podman/v2/pkg/specgen" "github.com/containers/podman/v2/pkg/specgen/generate" + "github.com/containers/podman/v2/pkg/util" "github.com/containers/storage" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -846,6 +847,12 @@ func (ic *ContainerEngine) ContainerRun(ctx context.Context, opts entities.Conta return nil, err } + if opts.CIDFile != "" { + if err := util.CreateCidFile(opts.CIDFile, ctr.ID()); err != nil { + return nil, err + } + } + var joinPod bool if len(ctr.PodID()) > 0 { joinPod = true diff --git a/pkg/domain/infra/tunnel/containers.go b/pkg/domain/infra/tunnel/containers.go index 7913d79cd..8066e1c00 100644 --- a/pkg/domain/infra/tunnel/containers.go +++ b/pkg/domain/infra/tunnel/containers.go @@ -21,6 +21,7 @@ import ( "github.com/containers/podman/v2/pkg/domain/entities" "github.com/containers/podman/v2/pkg/errorhandling" "github.com/containers/podman/v2/pkg/specgen" + "github.com/containers/podman/v2/pkg/util" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) @@ -558,6 +559,11 @@ func (ic *ContainerEngine) ContainerRun(ctx context.Context, opts entities.Conta for _, w := range con.Warnings { fmt.Fprintf(os.Stderr, "%s\n", w) } + if opts.CIDFile != "" { + if err := util.CreateCidFile(opts.CIDFile, con.ID); err != nil { + return nil, err + } + } report := entities.ContainerRunReport{Id: con.ID} |