diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-08-05 04:14:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-05 04:14:22 +0200 |
commit | 6260677012080aa6aa52ead7ec54261d8d6017a0 (patch) | |
tree | 91c2b997d41f36a67e9bce944bead5916b58da56 /pkg/domain | |
parent | 0a3f3c94f86a2539d4a0f98a782702b3809b3006 (diff) | |
parent | a0fb08100391f27c283e0bf62e5663222066b6bf (diff) | |
download | podman-6260677012080aa6aa52ead7ec54261d8d6017a0.tar.gz podman-6260677012080aa6aa52ead7ec54261d8d6017a0.tar.bz2 podman-6260677012080aa6aa52ead7ec54261d8d6017a0.zip |
Merge pull request #7224 from rhatdan/remove
Handle podman-remote run --rm
Diffstat (limited to 'pkg/domain')
-rw-r--r-- | pkg/domain/infra/tunnel/containers.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/pkg/domain/infra/tunnel/containers.go b/pkg/domain/infra/tunnel/containers.go index 1fad67b86..d2221ab7b 100644 --- a/pkg/domain/infra/tunnel/containers.go +++ b/pkg/domain/infra/tunnel/containers.go @@ -500,9 +500,6 @@ func (ic *ContainerEngine) ContainerList(ctx context.Context, options entities.C } func (ic *ContainerEngine) ContainerRun(ctx context.Context, opts entities.ContainerRunOptions) (*entities.ContainerRunReport, error) { - if opts.Rm { - logrus.Info("the remote client does not support --rm yet") - } con, err := containers.CreateWithSpec(ic.ClientCxt, opts.Spec) if err != nil { return nil, err @@ -526,6 +523,17 @@ func (ic *ContainerEngine) ContainerRun(ctx context.Context, opts entities.Conta if err != nil { report.ExitCode = define.ExitCode(err) } + if opts.Rm { + if err := containers.Remove(ic.ClientCxt, con.ID, bindings.PFalse, bindings.PTrue); err != nil { + if errors.Cause(err) == define.ErrNoSuchCtr || + errors.Cause(err) == define.ErrCtrRemoved { + logrus.Warnf("Container %s does not exist: %v", con.ID, err) + } else { + logrus.Errorf("Error removing container %s: %v", con.ID, err) + } + } + } + return &report, err } |