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

Ctrl+C doesn't kill the container using podman run with podman machine #11844

Closed
guillaumerose opened this issue Oct 4, 2021 · 9 comments
Closed
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. machine stale-issue

Comments

@guillaumerose
Copy link
Contributor

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

/kind bug

Description

After updating podman on my mac, I wanted to try to run a nginx container. It is not stopped when I hit ctrl+c.

Steps to reproduce the issue:

  1. podman machine start
  2. podman run -p 9090:80 -t docker.io/library/nginx:alpine
  3. hit ctrl+c
  4. podman ps

Describe the results you received:

$ podman ps                                              
CONTAINER ID  IMAGE                           COMMAND               CREATED        STATUS            PORTS                 NAMES
b59a53daf20c  docker.io/library/nginx:alpine  nginx -g daemon o...  3 seconds ago  Up 3 seconds ago  0.0.0.0:9090->80/tcp  reverent_jemison

Describe the results you expected:

$ podman ps                                              
CONTAINER ID  IMAGE                           COMMAND               CREATED        STATUS            PORTS                 NAMES
(nothing)

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

Output of podman version:

Client:
Version:      3.4.0
API Version:  3.4.0
Go Version:   go1.17.1
Built:        Thu Sep 30 20:44:31 2021
OS/Arch:      darwin/amd64

Server:
Version:      3.3.1
API Version:  3.3.1
Go Version:   go1.16.6
Built:        Mon Aug 30 22:46:36 2021
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.22.3
  cgroupControllers: []
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.0.29-2.fc34.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.0.29, commit: '
  cpus: 1
  distribution:
    distribution: fedora
    version: "34"
  eventLogger: journald
  hostname: localhost
  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.13.16-200.fc34.x86_64
  linkmode: dynamic
  logDriver: ""
  memFree: 1266466816
  memTotal: 2061852672
  ociRuntime:
    name: crun
    package: crun-1.0-1.fc34.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.0
      commit: 139dc6971e2f1d931af520188763e984d6cdfbf8
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    exists: true
    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
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: true
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.1.12-2.fc34.x86_64
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.4.0
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.0
  swapFree: 0
  swapTotal: 0
  uptime: 6m 42.48s
plugins:
  log: null
  network: null
  volume: null
registries:
  search:
  - docker.io
store:
  configFile: /var/home/core/.config/containers/storage.conf
  containerStore:
    number: 4
    paused: 0
    running: 1
    stopped: 3
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /var/home/core/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 1
  runRoot: /run/user/1000/containers
  volumePath: /var/home/core/.local/share/containers/storage/volumes
version:
  APIVersion: 3.3.1
  Built: 1630356396
  BuiltTime: Mon Aug 30 20:46:36 2021
  GitCommit: ""
  GoVersion: go1.16.6
  OsArch: linux/amd64
  Version: 3.3.1

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

(paste your output here)

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/master/troubleshooting.md)

Yes/No

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

macOS, installed with brew.

@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Oct 4, 2021
@mheon
Copy link
Member

mheon commented Oct 4, 2021

Any chance you can run the container with --log-level=debug and provide the full logs from that, including a few Ctrl-C presses? We should be logging our attempts to forward the signals.

@guillaumerose
Copy link
Contributor Author

I don't see the attempt:

$ podman run --log-level=debug -p 9090:80 -t docker.io/library/nginx:alpine
INFO[0000] podman filtering at log level debug          
DEBU[0000] Called run.PersistentPreRunE(podman run --log-level=debug -p 9090:80 -t docker.io/library/nginx:alpine) 
DEBU[0000] SSH Ident Key "/Users/guillaumerose/.ssh/podman-machine-default" SHA256:o3O27UO9NFdkpxHr7IoAGylgCVsudIlMl4OEx00a/TM ssh-ed25519 
DEBU[0000] Found SSH_AUTH_SOCK "/private/tmp/com.apple.launchd.dkNg1eJcMW/Listeners", ssh-agent signer(s) enabled 
DEBU[0000] DoRequest Method: GET URI: http://d/v3.4.0/libpod/_ping 
DEBU[0000] Adding port mapping from 9090 to 80 length 1 protocol "" 
DEBU[0000] Loading registries configuration "/etc/containers/registries.conf" 
DEBU[0000] DoRequest Method: POST URI: http://d/v3.4.0/libpod/images/pull 
DEBU[0000] DoRequest Method: POST URI: http://d/v3.4.0/libpod/containers/create 
INFO[0000] Going to attach to container "4e66996e71308edcd57c221cb4bd495fab9b7b820975f026b2cb0b96d79f4b93" 
DEBU[0000] DoRequest Method: GET URI: http://d/v3.4.0/libpod/containers/4e66996e71308edcd57c221cb4bd495fab9b7b820975f026b2cb0b96d79f4b93/json 
DEBU[0000] DoRequest Method: POST URI: http://d/v3.4.0/libpod/containers/4e66996e71308edcd57c221cb4bd495fab9b7b820975f026b2cb0b96d79f4b93/attach 
DEBU[0000] Copying STDOUT of container in terminal mode 
INFO[0000] Going to start container "4e66996e71308edcd57c221cb4bd495fab9b7b820975f026b2cb0b96d79f4b93" 
DEBU[0000] DoRequest Method: POST URI: http://d/v3.4.0/libpod/containers/4e66996e71308edcd57c221cb4bd495fab9b7b820975f026b2cb0b96d79f4b93/start 
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2021/10/04 13:35:35 [notice] 1#1: using the "epoll" event method
2021/10/04 13:35:35 [notice] 1#1: nginx/1.21.3
2021/10/04 13:35:35 [notice] 1#1: built by gcc 10.3.1 20210424 (Alpine 10.3.1_git20210424) 
2021/10/04 13:35:35 [notice] 1#1: OS: Linux 5.13.16-200.fc34.x86_64
2021/10/04 13:35:35 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 524288:524288
2021/10/04 13:35:35 [notice] 1#1: start worker processes
2021/10/04 13:35:35 [notice] 1#1: start worker process 27
^C
$
$
$

@Luap99
Copy link
Member

Luap99 commented Oct 4, 2021

Can you try with adding -i to podman run?

@guillaumerose
Copy link
Contributor Author

With -i, it is correctly killed. I see:

2021/10/04 15:26:00 [notice] 1#1: start worker process 27
^C2021/10/04 15:26:01 [notice] 1#1: signal 2 (SIGINT) received, exiting
2021/10/04 15:26:01 [notice] 27#27: signal 2 (SIGINT) received, exiting
2021/10/04 15:26:01 [notice] 27#27: exiting
2021/10/04 15:26:01 [notice] 27#27: exit
2021/10/04 15:26:01 [notice] 1#1: signal 17 (SIGCHLD) received from 27
2021/10/04 15:26:01 [notice] 1#1: worker process 27 exited with code 0
2021/10/04 15:26:01 [notice] 1#1: exit
DEBU[0001] DoRequest Method: POST URI: http://d/v3.4.0/libpod/containers/bc1cd8a9e1f972234685f97e9e16f552696440e0b0d9d549ba2c3b0b830d1b61/wait 
DEBU[0001] Called run.PersistentPostRunE(podman run --log-level=debug -p 9090:80 -ti docker.io/library/nginx:alpine)

@github-actions
Copy link

github-actions bot commented Nov 4, 2021

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Nov 4, 2021

Looks like your problem is solved, Closing.

@rhatdan rhatdan closed this as completed Nov 4, 2021
@ponimas
Copy link

ponimas commented Jun 22, 2022

I'm facing the same issue with one exception - adding the -i flag doesn't help.

podman run -i --log-level=debug nginx    
INFO[0000] podman filtering at log level debug          
DEBU[0000] Called run.PersistentPreRunE(podman run -i --log-level=debug nginx) 
DEBU[0000] SSH Ident Key "/Users/ponimas/.ssh/podman-machine-default" SHA256:tOvATDNZzT3jTcmqxc4SrKQnIicNP17+MTCNpfV3FIk ssh-ed25519 
DEBU[0000] Found SSH_AUTH_SOCK "/var/folders/ff/y12n_58x3yq88ysv7jk864p40000gn/T//ssh-itLGKjzLvN9B/agent.595", ssh-agent signer(s) enabled 
DEBU[0000] SSH Agent Key SHA256:ucuqyTCiUBQSM+huZ1uxzQHtO9OMdHFwrvuUlxwXxMM ssh-rsa 
DEBU[0000] DoRequest Method: GET URI: http://d/v4.1.1/libpod/_ping 
DEBU[0000] Loading registries configuration "/etc/containers/registries.conf" 
DEBU[0000] No credentials matching pierone.stups.zalan.do found in /Users/ponimas/.config/containers/auth.json 
DEBU[0000] No credentials matching pierone.stups.zalan.do found in /Users/ponimas/.config/containers/auth.json 
DEBU[0000] Looking up in credential helper pierone based on credHelpers entry in /Users/ponimas/.docker/config.json 
DEBU[0000] Found credentials for pierone.stups.zalan.do in credential helper containers-auth.json in file /Users/ponimas/.docker/config.json 
DEBU[0000] DoRequest Method: POST URI: http://d/v4.1.1/libpod/images/pull 
DEBU[0000] DoRequest Method: POST URI: http://d/v4.1.1/libpod/containers/create 
INFO[0000] Going to attach to container "9230994b5cb15e214ab521349ce9b419ed073646c5a51adb8fc55319ff64e8e9" 
DEBU[0000] DoRequest Method: GET URI: http://d/v4.1.1/libpod/containers/9230994b5cb15e214ab521349ce9b419ed073646c5a51adb8fc55319ff64e8e9/json 
DEBU[0000] DoRequest Method: POST URI: http://d/v4.1.1/libpod/containers/9230994b5cb15e214ab521349ce9b419ed073646c5a51adb8fc55319ff64e8e9/attach 
DEBU[0000] Copying standard streams of container "9230994b5cb15e214ab521349ce9b419ed073646c5a51adb8fc55319ff64e8e9" in non-terminal mode 
INFO[0000] Going to start container "9230994b5cb15e214ab521349ce9b419ed073646c5a51adb8fc55319ff64e8e9" 
DEBU[0000] DoRequest Method: POST URI: http://d/v4.1.1/libpod/containers/9230994b5cb15e214ab521349ce9b419ed073646c5a51adb8fc55319ff64e8e9/start 
DEBU[0000] Copying STDIN to socket                      
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2022/06/22 12:56:15 [notice] 1#1: using the "epoll" event method
2022/06/22 12:56:15 [notice] 1#1: nginx/1.21.6
2022/06/22 12:56:15 [notice] 1#1: built by gcc 10.2.1 20210110 (Debian 10.2.1-6) 
2022/06/22 12:56:15 [notice] 1#1: OS: Linux 5.18.5-200.fc36.aarch64
2022/06/22 12:56:15 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 524288:524288
2022/06/22 12:56:15 [notice] 1#1: start worker processes
2022/06/22 12:56:15 [notice] 1#1: start worker process 26
2022/06/22 12:56:15 [notice] 1#1: start worker process 27
^C
podman ps
CONTAINER ID  IMAGE                           COMMAND               CREATED      STATUS          PORTS       NAMES
9230994b5cb1  docker.io/library/nginx:latest  nginx -g daemon o...  4 hours ago  Up 4 hours ago              relaxed_yonath
podman version        
Client:       Podman Engine
Version:      4.1.1
API Version:  4.1.1
Go Version:   go1.18.3
Built:        Tue Jun 14 22:12:46 2022
OS/Arch:      darwin/arm64

Server:       Podman Engine
Version:      4.1.0
API Version:  4.1.0
Go Version:   go1.18.2
Built:        Mon May 30 18:04:32 2022
OS/Arch:      linux/arm64
 podman info --debug
host:
  arch: arm64
  buildahVersion: 1.26.1
  cgroupControllers:
  - cpu
  - io
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.0-2.fc36.aarch64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.0, commit: '
  cpuUtilization:
    idlePercent: 99.6
    systemPercent: 0.27
    userPercent: 0.13
  cpus: 2
  distribution:
    distribution: fedora
    variant: coreos
    version: "36"
  eventLogger: journald
  hostname: localhost.localdomain
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 1000000
    uidmap:
    - container_id: 0
      host_id: 501
      size: 1
    - container_id: 1
      host_id: 100000
      size: 1000000
  kernel: 5.18.5-200.fc36.aarch64
  linkmode: dynamic
  logDriver: journald
  memFree: 3503218688
  memTotal: 4090519552
  networkBackend: netavark
  ociRuntime:
    name: crun
    package: crun-1.4.5-1.fc36.aarch64
    path: /usr/bin/crun
    version: |-
      crun version 1.4.5
      commit: c381048530aa750495cf502ddb7181f2ded5b400
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    exists: true
    path: /run/user/501/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: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: true
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.2.0-0.2.beta.0.fc36.aarch64
    version: |-
      slirp4netns version 1.2.0-beta.0
      commit: 477db14a24ff1a3de3a705e51ca2c4c1fe3dda64
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 0
  swapTotal: 0
  uptime: 2h 16m 36.87s (Approximately 0.08 days)
plugins:
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries:
  search:
  - docker.io
store:
  configFile: /var/home/core/.config/containers/storage.conf
  containerStore:
    number: 3
    paused: 0
    running: 1
    stopped: 2
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /var/home/core/.local/share/containers/storage
  graphRootAllocated: 106825756672
  graphRootUsed: 3219890176
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 4
  runRoot: /run/user/501/containers
  volumePath: /var/home/core/.local/share/containers/storage/volumes
version:
  APIVersion: 4.1.0
  Built: 1653926672
  BuiltTime: Mon May 30 18:04:32 2022
  GitCommit: ""
  GoVersion: go1.18.2
  Os: linux
  OsArch: linux/arm64
  Version: 4.1.0

Should I file a new bug?

@mheon
Copy link
Member

mheon commented Jun 22, 2022

Please do

@ponimas
Copy link

ponimas commented Jun 23, 2022

@mheon #14707

@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 20, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 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. machine stale-issue
Projects
None yet
Development

No branches or pull requests

5 participants