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

events API docker compatibility issue #16857

Closed
chilikk opened this issue Dec 15, 2022 · 2 comments · Fixed by #16912
Closed

events API docker compatibility issue #16857

chilikk opened this issue Dec 15, 2022 · 2 comments · Fixed by #16912
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

@chilikk
Copy link

chilikk commented Dec 15, 2022

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

/kind bug

Description

Podman expects the podman-style "died" name of the event rather than docker-style "die" event in an event filter expression. This is a compatibility issue with docker-compatible clients.

Steps to reproduce the issue:

  1. Start a container sleeping for a short period of time

  2. Subscribe to events using Docker compatibility API, indicating the following filter {"event":["die"]} and observe the absence of events.

To compare with a working case, repeat steps 1 and 2 substituting the filter for {"event": ["died"]} and observe the event called die when the container in step 1 finishes.

In form of script, steps 1 and 2 (using docker-style event name):

sudo podman run -d --rm --name test alpine sleep 2
sudo curl --unix /run/podman/podman.sock 'http://localhost/events?filters=%7B"container":%5B"test"%5D,"event
":%5B"die"%5D%7D'
# no event here

Using podman-style event name:

sudo podman run -d --rm --name test alpine sleep 2
sudo curl --unix /run/podman/podman.sock 'http://localhost/events?filters=%7B"container":%5B"test"%5D,"event
":%5B"died"%5D%7D'
# the event is printed

Describe the results you received:

No event arrives in step 2 of the reproduction example.

Describe the results you expected:

I expected to see the "die" event from step 2 in the reproduction example:

{"status":"die","id":"b04f2ec34e7972ee8cd405474e73805db0aa082b3fb12e20958e9c3a781d5bc0","from":"docker.io/library/alpine:latest","Type":"container","Action":"die","Actor":{"ID":"b04f2ec34e7972ee8cd405474e73805db0aa082b3fb12e20958e9c3a781d5bc0","Attributes":{"containerExitCode":"0","exitCode":"0","image":"docker.io/library/alpine:latest","name":"test","podId":""}},"scope":"local","time":1671122524,"timeNano":1671122524154484836}

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

I think both die and died should be supported in a filter expression, for backwards compatibility with previous Podman versions.

Output of podman version:

$ podman version
Client:       Podman Engine
Version:      4.3.1
API Version:  4.3.1
Go Version:   go1.19.4
Built:        Tue Dec 13 02:00:33 2022
OS/Arch:      linux/amd64

Output of podman info:

$ podman info
host:
  arch: amd64
  buildahVersion: 1.28.0
  cgroupControllers: []
  cgroupManager: cgroupfs
  cgroupVersion: v1
  conmon:
    package: conmon-2.1.5-r0
    path: /usr/bin/conmon
    version: 'conmon version 2.1.5, commit: unknown'
  cpuUtilization:
    idlePercent: 99.73
    systemPercent: 0.11
    userPercent: 0.16
  cpus: 1
  distribution:
    distribution: alpine
    version: 3.17.0
  eventLogger: file
  hostname: h01
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
  kernel: 5.15.82-0-virt
  linkmode: dynamic
  logDriver: k8s-file
  memFree: 1841414144
  memTotal: 2087096320
  networkBackend: netavark
  ociRuntime:
    name: crun
    package: crun-1.7.2-r0
    path: /usr/bin/crun
    version: |-
      crun version 1.7.2
      commit: 0356bf4aff9a133d655dc13b1d9ac9424706cac4
      rundir: /tmp/podman-run-1000/crun
      spec: 1.0.0
      +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +YAJL
  os: linux
  remoteSocket:
    path: /tmp/podman-run-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
    seccompProfilePath: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.2.0-r0
    version: |-
      slirp4netns version 1.2.0
      commit: 656041d45cfca7a4176f6b7eed9e4fe6c11e8383
      libslirp: 4.7.0
      SLIRP_CONFIG_VERSION_MAX: 4
      libseccomp: 2.5.4
  swapFree: 0
  swapTotal: 0
  uptime: 1h 19m 14.00s (Approximately 0.04 days)
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  network:
  - bridge
  - macvlan
  volume:
  - local
registries:
  search:
  - docker.io
store:
  configFile: /home/docker/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/docker/.local/share/containers/storage
  graphRootAllocated: 4226809856
  graphRootUsed: 286445568
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 0
  runRoot: /tmp/podman-run-1000/containers
  volumePath: /home/docker/.local/share/containers/storage/volumes
version:
  APIVersion: 4.3.1
  Built: 1670896833
  BuiltTime: Tue Dec 13 02:00:33 2022
  GitCommit: ""
  GoVersion: go1.19.4
  Os: linux
  OsArch: linux/amd64
  Version: 4.3.1

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

$ apk info podman
podman-4.3.1-r1 description:
Simple management tool for pods, containers and images

podman-4.3.1-r1 webpage:
https://podman.io/

podman-4.3.1-r1 installed size:
39 MiB

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.):

@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Dec 15, 2022
@vrothberg
Copy link
Member

@chilikk thanks for reaching out. Do I read the issue correctly that Podman should support "die" as an event input?

@chilikk
Copy link
Author

chilikk commented Dec 16, 2022

Yes, this is correct. die is the name of the event supported by Docker, and also the name of the event that Podman uses when sending events over the Docker compatibility API ({"status":"die"), so I think that it should be supported as the name of the event in the filter expression when using the Docker compatibility API.

vrothberg added a commit to vrothberg/libpod that referenced this issue Dec 21, 2022
Map "die" to the "died" status for Docker compat.

Fixes: containers#16857
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
vrothberg added a commit to vrothberg/libpod that referenced this issue Dec 21, 2022
Map "die" to the "died" status for Docker compat.

Fixes: containers#16857
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
vrothberg added a commit to vrothberg/libpod that referenced this issue Dec 22, 2022
Map "die" to the "died" status for Docker compat.

Fixes: containers#16857
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
@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 6, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 6, 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.

2 participants