summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/abi/containers.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2020-10-23 06:58:41 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2020-10-26 05:53:26 -0400
commit32af1be01a37362d81baff47a2bb28e4c863a8c9 (patch)
treecd61e6e4bb016b4c73da7819343fb983cee3c730 /pkg/domain/infra/abi/containers.go
parent8f498b52de43b20d5f9aa83c3a27e0464d41bdee (diff)
downloadpodman-32af1be01a37362d81baff47a2bb28e4c863a8c9.tar.gz
podman-32af1be01a37362d81baff47a2bb28e4c863a8c9.tar.bz2
podman-32af1be01a37362d81baff47a2bb28e4c863a8c9.zip
The cidfile should be created when the container is created
Currently if you run an interactive session of podman run and specifiy the --cidfile option, the cidfile will not get created until the container finishes running. If you run a detached container, it will get created right away. This Patch creates the cidfile as soon as the container is created. This could allow other tools to use the cidefile on all running containers. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/domain/infra/abi/containers.go')
-rw-r--r--pkg/domain/infra/abi/containers.go7
1 files changed, 7 insertions, 0 deletions
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