Skip to content

Add ability to remove container and all its dependents #10360

Closed
@dsedivec

Description

@dsedivec

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind feature

Description

I would like to be able to remove a container along with all of its dependent containers.

Steps to reproduce the issue:

  1. podman create --name=alpha docker.io/alpine

  2. podman create --name=bravo --net=container:alpha docker.io/alpine

  3. podman rm -f alpha

Describe the results you received:

Error: container 41f2e5f2cf31e77e4281264d6137a0590536d607804d27ff73f779bfe9d9248d has dependent containers which must be removed before it: 15f02bce50a1fc6788b6b25166da96d90fcdbc256abd8cfdd487b4f17b1b49c4: container already exists

Describe the results you expected:

alpha and bravo containers are removed

Additional information you deem important (e.g. issue happens only occasionally):

While this would be really helpful when I'm working at the CLI, I also have a goal to let Ansible's podman_container restart a container with dependencies when necessary (e.g. image has been updated). In that case, later steps in the playbook will be creating/updating the dependent containers anyway.

I'm not married to --force being the switch used to do this, a new switch could be used.

Output of podman version:

podman version
Version:      3.1.2
API Version:  3.1.2
Go Version:   go1.16
Built:        Thu Apr 22 06:11:28 2021
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.20.1
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.0.27-2.fc34.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.0.27, commit: '
  cpus: 8
  distribution:
    distribution: fedora
    version: "34"
  eventLogger: journald
  hostname: mmhmm
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 5.11.13-300.fc34.x86_64
  linkmode: dynamic
  memFree: 782872576
  memTotal: 16676921344
  ociRuntime:
    name: runc
    package: runc-1.0.0-377.rc93.fc34.x86_64
    path: /usr/bin/runc
    version: |-
      runc version 1.0.0-rc93
      commit: 48389904331fdebba5e2db73147c067560a51d80
      spec: 1.0.2-dev
      go: go1.16
      libseccomp: 2.5.0
  os: linux
  remoteSocket:
    path: /run/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: false
    seccompEnabled: true
    selinuxEnabled: true
  slirp4netns:
    executable: ""
    package: ""
    version: ""
  swapFree: 16981417984
  swapTotal: 17179860992
  uptime: 357h 25m 26.72s (Approximately 14.88 days)
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - docker.io
  - quay.io
store:
  configFile: /etc/containers/storage.conf
  containerStore:
    number: 5
    paused: 0
    running: 1
    stopped: 4
  graphDriverName: overlay
  graphOptions:
    overlay.mountopt: nodev,metacopy=on
  graphRoot: /var/lib/containers/storage
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "true"
  imageStore:
    number: 25
  runRoot: /run/containers/storage
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 3.1.2
  Built: 1619097088
  BuiltTime: Thu Apr 22 06:11:28 2021
  GitCommit: ""
  GoVersion: go1.16
  OsArch: linux/amd64
  Version: 3.1.2

Package info (e.g. output of rpm -q podman or apt list podman):

podman-3.1.2-1.fc34.x86_64

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/master/troubleshooting.md)

Yes

Metadata

Metadata

Assignees

Labels

Good First IssueThis issue would be a good issue for a first time contributor to undertake.kind/featureCategorizes issue or PR as related to a new feature.locked - please file new issue/PRAssist humans wanting to comment on an old issue or PR with locked comments.stale-issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions