Skip to content

BUG: Incorrect behavior of podman container logs with -f and --follow flags #25653

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

Closed
bupd opened this issue Mar 23, 2025 · 3 comments · Fixed by #25707
Closed

BUG: Incorrect behavior of podman container logs with -f and --follow flags #25653

bupd opened this issue Mar 23, 2025 · 3 comments · Fixed by #25707
Assignees
Labels
jira kind/bug Categorizes issue or PR as related to a bug.

Comments

@bupd
Copy link

bupd commented Mar 23, 2025

Issue Description

I encountered an issue with the podman container logs command where the flags are misinterpreted as container-names.

Steps to reproduce the issue

Steps to reproduce the issue

  1. run a container in podman
  2. try to access the container logs using podman container logs <container_name> -f
  3. You will see the below error
Error: no container with name or ID "-f" found: no such container

Describe the results you received

The below cmd works fine.

❯ podman container logs -f <container_name>

However, using the -f flag after the container name results in the following error:

❯ podman container logs <container_name> -f
Error: no container with name or ID "-f" found: no such container

Similarly, using --follow=true produces the error:

❯ podman container logs <container_name> --follow=true
Error: no container with name or ID "--follow=true" found: no such container

Describe the results you expected

❯ podman container logs <container_name> -f

Expected the above command to work fine

podman info output

host:
  arch: amd64
  buildahVersion: 1.39.0
  cgroupControllers:
  - cpu
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-1:2.1.13-1
    path: /usr/bin/conmon
    version: 'conmon version 2.1.13, commit: 82de887596ed8ee6d9b2ee85e4f167f307bb569b'
  cpuUtilization:
    idlePercent: 96.61
    systemPercent: 0.73
    userPercent: 2.66
  cpus: 12
  databaseBackend: sqlite
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  freeLocks: 1950
  hostname: ARCHBTW
  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: 6.12.17-1-lts
  linkmode: dynamic
  logDriver: journald
  memFree: 3233013760
  memTotal: 16644427776
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns-1.14.0-1
      path: /usr/lib/podman/aardvark-dns
      version: aardvark-dns 1.14.0
    package: netavark-1.14.0-1
    path: /usr/lib/podman/netavark
    version: netavark 1.14.0
  ociRuntime:
    name: runc
    package: runc-1.2.5-1
    path: /usr/bin/runc
    version: |-
      runc version 1.2.5
      spec: 1.2.0
      go: go1.24.0
      libseccomp: 2.5.5
  os: linux
  pasta:
    executable: /usr/bin/pasta
    package: passt-2025_02_17.a1e48a0-1
    version: ""
  remoteSocket:
    exists: true
    path: /run/user/1000/podman/podman.sock
  rootlessNetworkCmd: pasta
  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
    seccompProfilePath: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: ""
    package: ""
    version: ""
  swapFree: 17176719360
  swapTotal: 17179865088
  uptime: 2h 39m 49.00s (Approximately 0.08 days)
  variant: ""
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - docker.io
store:
  configFile: /home/bupd/.config/containers/storage.conf
  containerStore:
    number: 11
    paused: 0
    running: 8
    stopped: 3
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/bupd/.local/share/containers/storage
  graphRootAllocated: 273631555584
  graphRootUsed: 145692721152
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Supports shifting: "false"
    Supports volatile: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 94
  runRoot: /run/user/1000/containers
  transientStore: false
  volumePath: /home/bupd/.local/share/containers/storage/volumes
version:
  APIVersion: 5.4.0
  Built: 1739309709
  BuiltTime: Wed Feb 12 03:05:09 2025
  GitCommit: f9f7d48b24b1ca4403f189caaeab1cb8ff4a9aa2
  GoVersion: go1.24.0
  Os: linux
  OsArch: linux/amd64
  Version: 5.4.0

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

Yes

Additional information

I am happy to help fix this issue. Thanks

@bupd bupd added the kind/bug Categorizes issue or PR as related to a bug. label Mar 23, 2025
@baude
Copy link
Member

baude commented Mar 24, 2025

Seems like the CLI is acting as instructed. I know some linux/unix commands allow placement of - flags at any point on the command line but here I thought order mattered. wdyt @Luap99

@bupd
Copy link
Author

bupd commented Mar 24, 2025

@baude Why does the order matter here?

Would love to hear your thoughts

Thanks

@Luap99
Copy link
Member

Luap99 commented Mar 24, 2025

Almost all of our commands allow arbitrary placement of flags. There are special cases like podman create/run where all arguments after image as considered arguments for the container not the podman command. However for podman logs that simply seems unnecessary, you cannot even have container names starting with - anyway so I would say this should just be allowed.

@Luap99 Luap99 self-assigned this Mar 27, 2025
@Luap99 Luap99 added the jira label Mar 27, 2025
Luap99 added a commit to Luap99/libpod that referenced this issue Mar 27, 2025
Do not use the interspersed option for logs, it is not needed and just
restricts valid use cases.

Fixes containers#25653

Signed-off-by: Paul Holzinger <[email protected]>
Luap99 added a commit to Luap99/libpod that referenced this issue Mar 28, 2025
Do not use the interspersed option for logs, it is not needed and just
restricts valid use cases.

Fixes containers#25653

Signed-off-by: Paul Holzinger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jira kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants