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 --cidfile without --detach only writes the id after completion #8091

Closed
ghost opened this issue Oct 21, 2020 · 1 comment · Fixed by #8094
Closed

podman run --cidfile without --detach only writes the id after completion #8091

ghost opened this issue Oct 21, 2020 · 1 comment · Fixed by #8094
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

@ghost
Copy link

ghost commented Oct 21, 2020

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

/kind bug

Description

Steps to reproduce the issue:

  1. podman pull alpine (or any container for that matter)
  2. podman run -it --cidfile cid alpine sh (keep the command running)
  3. In another terminal: cat cid
  4. Exit the shell in alpine, so that the container stops
  5. cat cid

Describe the results you received:
In step 3, the cid file doesn't contain a container id, only in step 5.

Describe the results you expected:
In step 3 there should have already been a container id.

This is becaue the ID only gets written after running the container has finished, which is only after the container was stopped when not passing --detach:

report, err := registry.ContainerEngine().ContainerRun(registry.GetContext(), runOpts)
// report.ExitCode is set by ContainerRun even it it returns an error
if report != nil {
registry.SetExitCode(report.ExitCode)
}
if err != nil {
return err
}
if cidFile != nil {
_, err = cidFile.WriteString(report.Id)
if err != nil {
logrus.Error(err)
}
}

Ideally this should be fixed so that the cid is written for an already running container.
If this can't be easily fixed, or won't be fixed, at least the documentation should be updated to contain that information!

Output of podman version:

podman version 2.1.1

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.16.1
  cgroupManager: cgroupfs
  cgroupVersion: v1
  conmon:
    package: Unknown
    path: /usr/bin/conmon
    version: 'conmon version 2.0.21, commit: 35a2fa83022e56e18af7e6a865ba5d7165fa2a4a'
  cpus: 48
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  hostname: max-threadripper-arch
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 165536
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 165536
      size: 65536
  kernel: 5.9.1-arch1-1
  linkmode: dynamic
  memFree: 51220316160
  memTotal: 67374821376
  ociRuntime:
    name: runc
    package: Unknown
    path: /usr/bin/runc
    version: |-
      runc version 1.0.0-rc92
      commit: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
      spec: 1.0.2-dev
  os: linux
  remoteSocket:
    path: /run/user/1000/podman/podman.sock
  rootless: true
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: Unknown
    version: |-
      slirp4netns version 1.1.4
      commit: b66ffa8e262507e37fca689822d23430f3357fe8
      libslirp: 4.3.1
      SLIRP_CONFIG_VERSION_MAX: 3
  swapFree: 0
  swapTotal: 0
  uptime: 2h 51m 17.41s (Approximately 0.08 days)
registries:
  search:
  - docker.io
  - registry.fedoraproject.org
  - quay.io
  - registry.access.redhat.com
  - registry.centos.org
store:
  configFile: /home/max/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions:
    overlay.mount_program:
      Executable: /usr/bin/fuse-overlayfs
      Package: Unknown
      Version: |-
        fusermount3 version: 3.10.0
        fuse-overlayfs: version 1.1.0
        FUSE library version 3.10.0
        using FUSE kernel interface version 7.31
  graphRoot: /home/max/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 4
  runRoot: /run/user/1000/containers
  volumePath: /home/max/.local/share/containers/storage/volumes
version:
  APIVersion: 2.0.0
  Built: 1601135437
  BuiltTime: Sat Sep 26 17:50:37 2020
  GitCommit: 9f6d6ba0b314d86521b66183c9ce48eaa2da1de2
  GoVersion: go1.15.2
  OsArch: linux/amd64
  Version: 2.1.1

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

$ LANG=en_US.UTF-8 pacman -Qi podman
Name            : podman
Version         : 2.1.1-1
Description     : Tool and library for running OCI-based containers in pods
Architecture    : x86_64
URL             : https://github.com/containers/libpod
Licenses        : Apache
Groups          : None
Provides        : None
Depends On      : cni-plugins  conmon  device-mapper  iptables  libseccomp  runc  slirp4netns  libsystemd  fuse-overlayfs  skopeo
Optional Deps   : podman-docker: for Docker-compatible CLI
                  btrfs-progs: support btrfs backend devices [installed]
                  catatonit: --init flag support
                  crun: support for unified cgroupsv2 [installed]
Required By     : podman-compose
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 77.95 MiB
Packager        : Morten Linderud <[email protected]>
Build Date      : Sat 26 Sep 2020 05:50:37 PM CEST
Install Date    : Sun 27 Sep 2020 10:37:06 PM CEST
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature

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

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Oct 21, 2020
@ghost ghost changed the title podman run --cidfile only writes the id after completion without --detach podman run --cidfile without --detach only writes the id after completion Oct 21, 2020
@ghost
Copy link
Author

ghost commented Nov 5, 2020

Thanks for the quick fix!

@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 Sep 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 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

Successfully merging a pull request may close this issue.

1 participant