Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

podman run --replace does not work with --detach #20185

Closed
maflcko opened this issue Sep 28, 2023 · 5 comments
Closed

podman run --replace does not work with --detach #20185

maflcko opened this issue Sep 28, 2023 · 5 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@maflcko
Copy link

maflcko commented Sep 28, 2023

Issue Description

podman run --detach can be used to print the ID of the container. However, if used in combination with --replace, it may (or may not) print the container name as well.

This is confusing, and it would be better to consistently not print the container name, or update the documentation.

Steps to reproduce the issue

$ podman --version 
podman version 4.6.2
$ podman run -it -d --rm --replace --name test1 ubuntu:jammy  # No name is printed
f00064ad5c5a7131d29fe16d389c8ded7644b0f27b9401061d78e05989d392a1
$ podman run -it -d --rm --replace --name test1 ubuntu:jammy  # Name is printed
WARN[0010] StopSignal SIGTERM failed to stop container test1 in 10 seconds, resorting to SIGKILL 
test1
11f997f00144d9fca4e9b1c3421243756093eee9a62f505d84cb3d805f7660d8

Describe the results you received

Describe the results you expected

podman info output

host:
  arch: riscv64
  buildahVersion: 1.28.2
  cgroupControllers:
  - cpuset
  - cpu
  - io
  - memory
  - hugetlb
  - pids
  - rdma
  - misc
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon_2.1.6+ds1-1_riscv64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.6, commit: unknown'
  cpuUtilization:
    idlePercent: 90.86
    systemPercent: 0.96
    userPercent: 8.18
  cpus: 4
  distribution:
    codename: lunar
    distribution: ubuntu
    version: "23.04"
  eventLogger: journald
  hostname: ubuntu
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 6.2.0-19-generic
  linkmode: dynamic
  logDriver: journald
  memFree: 1458507776
  memTotal: 4092555264
  networkBackend: netavark
  ociRuntime:
    name: crun
    package: crun_1.8-1_riscv64
    path: /usr/bin/crun
    version: |-
      crun version 1.8
      commit: 0356bf4aff9a133d655dc13b1d9ac9424706cac4
      rundir: /run/user/0/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +YAJL
  os: linux
  remoteSocket:
    exists: true
    path: /run/podman/podman.sock
  security:
    apparmorEnabled: true
    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
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns_1.2.0-1_riscv64
    version: |-
      slirp4netns version 1.2.0
      commit: 656041d45cfca7a4176f6b7eed9e4fe6c11e8383
      libslirp: 4.7.0
      SLIRP_CONFIG_VERSION_MAX: 4
      libseccomp: 2.5.4
  swapFree: 12858683392
  swapTotal: 12884897792
  uptime: 690h 56m 3.00s (Approximately 28.75 days)
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries: {}
store:
  configFile: /usr/share/containers/storage.conf
  containerStore:
    number: 1
    paused: 0
    running: 1
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /var/lib/containers/storage
  graphRootAllocated: 123723825152
  graphRootUsed: 23621816320
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 4
  runRoot: /run/containers/storage
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 4.3.1
  Built: 0
  BuiltTime: Thu Jan  1 00:00:00 1970
  GitCommit: ""
  GoVersion: go1.20.2
  Os: linux
  OsArch: linux/riscv64
  Version: 4.3.1

Podman in a container

No

Privileged Or Rootless

None

Upstream Latest Release

No

Additional environment details

Additional information

@maflcko maflcko added the kind/bug Categorizes issue or PR as related to a bug. label Sep 28, 2023
@giuseppe
Copy link
Member

The current behavior informs the user that an existing container was stopped, while we would lose this information if we print only the new ID, and you can still grab it correctly by looking only at the last line of the output.

Is it something we'd like to keep and document or uniform it to podman run without --replace?

@baude
Copy link
Member

baude commented Sep 28, 2023

i think this is a bug, what say you @mheon

@giuseppe
Copy link
Member

I can work on a PR if you all agree it must just be the cid for the created container

@vrothberg
Copy link
Member

I agree, only CID. Thanks, @giuseppe !

@giuseppe
Copy link
Member

PR here: #20189

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Dec 29, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

No branches or pull requests

4 participants