containers / podman

Podman: A tool for managing OCI containers and pods.
https://podman.io
Apache License 2.0
23.27k stars 2.37k forks source link

podman run --replace fails if the replaced image was created with --rm #9541

Closed martinetd closed 3 years ago

martinetd commented 3 years ago

/kind bug

Description

Running podman run --replace --name test_replace image often fails when the previous podman run with same name had --rm option

Steps to reproduce the issue:

  1. podman run -d --rm --name test_replace docker.io/alpine sleep 1000

  2. podman run -d --rm --replace --name test_replace docker.io/alpine sleep 1000

  3. might need to run 2. a few times as it sometimes works. It can fail without --rm the second time around, I've only left it there for testing.

Describe the results you received:

Containers fails starting:

$ podman run -d --rm --replace --name test_replace docker.io/alpine sleep 1000
718e85a4f6e229840db59b1381f20bd1b6d703a8197b79e620b6fedc3b8f1340

$ podman run -d --rm --replace --name test_replace docker.io/alpine sleep 1000
718e85a4f6e229840db59b1381f20bd1b6d703a8197b79e620b6fedc3b8f1340
8b0477e1ca87567f2550da0dd599103f58c876d149faa0adffbc20fd74fa323b

$ podman run -d --rm --replace --name test_replace docker.io/alpine sleep 1000
ERRO[0010] Error stopping container 8b0477e1ca87567f2550da0dd599103f58c876d149faa0adffbc20fd74fa323b exec sessions: container has already been removed 
Error: error saving container 8b0477e1ca87567f2550da0dd599103f58c876d149faa0adffbc20fd74fa323b state: container has already been removed

$ podman container inspect test_replace
[]
Error: error inspecting object: no such container test_replace

Describe the results you expected: Should work 100%

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

Output of podman version:

Version:      3.0.1
API Version:  3.0.0
Go Version:   go1.15.8
Built:        Thu Jan  1 09:00:00 1970
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.19.6
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: 'conmon: /usr/bin/conmon'
    path: /usr/bin/conmon
    version: 'conmon version 2.0.25, commit: unknown'
  cpus: 8
  distribution:
    distribution: debian
    version: unknown
  eventLogger: journald
  hostname: myhostname
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 5.10.0-2-amd64
  linkmode: dynamic
  memFree: 1190137856
  memTotal: 16558923776
  ociRuntime:
    name: crun
    package: 'crun: /usr/bin/crun'
    path: /usr/bin/crun
    version: |-
      crun version 0.17
      commit: 0e9229ae34caaebcb86f1fde18de3acaf18c6d9a
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +YAJL
  os: linux
  remoteSocket:
    path: /run/user/1000/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: true
    seccompEnabled: true
    selinuxEnabled: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: 'slirp4netns: /usr/bin/slirp4netns'
    version: |-
      slirp4netns version 1.0.1
      commit: 6a7b16babc95b6a3056b33fb45b74a6f62262dd4
      libslirp: 4.4.0
  swapFree: 27117907968
  swapTotal: 28277895168
  uptime: 319h 11m 59.89s (Approximately 13.29 days)
registries:
  localhost:80:
    Blocked: false
    Insecure: true
    Location: localhost:80
    MirrorByDigestOnly: false
    Mirrors: null
    Prefix: localhost:80
  localhost:5000:
    Blocked: false
    Insecure: true
    Location: localhost:5000
    MirrorByDigestOnly: false
    Mirrors: null
    Prefix: localhost:5000
store:
  configFile: /home/myuser/.config/containers/storage.conf
  containerStore:
    number: 6
    paused: 0
    running: 6
    stopped: 0
  graphDriverName: overlay
  graphOptions:
    overlay.mount_program:
      Executable: /usr/bin/fuse-overlayfs
      Package: 'fuse-overlayfs: /usr/bin/fuse-overlayfs'
      Version: |-
        fusermount3 version: 3.10.2
        fuse-overlayfs: version 1.4
        FUSE library version 3.10.2
        using FUSE kernel interface version 7.31
  graphRoot: /home/myuser/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: btrfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 57
  runRoot: /run/user/1000/containers
  volumePath: /home/myuser/.local/share/containers/storage/volumes
version:
  APIVersion: 3.0.0
  Built: 0
  BuiltTime: Thu Jan  1 09:00:00 1970
  GitCommit: ""
  GoVersion: go1.15.8
  OsArch: linux/amd64
  Version: 3.0.1

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

$ apt list podman
Listing... Done
podman/unstable,now 3.0.1+dfsg1-1 amd64 [installed]
podman/testing 3.0.0+dfsg1-2 i386

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide?

Yes

Additional environment details (AWS, VirtualBox, physical, etc.):

physical

vrothberg commented 3 years ago

Thanks for reaching out! This issue has been fixed in the main branch by commit e5ac28f3b968.

martinetd commented 3 years ago

ah, looked for replace in issues, sorry for missing it. Thanks!