Docker exec hangs on latest centos image

Hello,

I have an issue with docker exec - it hangs on my centos container.

Info:

Docker Version:
#############
Client:
Version: 18.09.1
API version: 1.39
Go version: go1.10.6
Git commit: 4c52b90
Built: Wed Jan 9 19:35:01 2019
OS/Arch: linux/amd64
Experimental: false

Server: Docker Engine - Community
Engine:
Version: 18.09.1
API version: 1.39 (minimum version 1.12)
Go version: go1.10.6
Git commit: 4c52b90
Built: Wed Jan 9 19:06:30 2019
OS/Arch: linux/amd64
Experimental: false

Docker info:
##########

Containers: 1
Running: 1
Paused: 0
Stopped: 0
Images: 40
Server Version: 18.09.1
Storage Driver: overlay2
Backing Filesystem: xfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9754871865f7fe2f4e74d43e2fc7ccd237edcbce
runc version: 96ec2177ae841256168fcf76954f7177af9446eb
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-862.el7.x86_64
Operating System: Red Hat Enterprise Linux
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 4.552GiB
Name: roadone
ID: XLPJ:RIYV:5FAM:SCY5:SPAE:HOKI:F2Z5:BTA2:34GQ:OAJ2:SNOW:YSGX
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled

What command I’m trying to execute:
##############################

COMMAND: /usr/bin/docker exec -i test_LINUX sh -c ‘ps’
OUTPUT:
PID TTY TIME CMD
1 ? 00:00:00 bash
441 ? 00:00:00 ps
<hangs here - the terminal never returns>

I have read a lot of posts related to this issue. It seems to be a bug but what causes it and how it can be resolved I did not understand…

Can someone guide me a bit with this issue? Does a workaround exist?

Thanks a lot!

Hi. How did you start the container?

🐳  gforghetti:[~] $ docker container run -d --name centos centos:latest sleep infinity
e0d763e33c954575f13b660b8767b8fffaf55cffaeb3def7b71ef8b6cc56df2b
🐳  gforghetti:[~] $ docker container ls
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
e0d763e33c95        centos:latest       "sleep infinity"    5 seconds ago       Up 4 seconds                            centos
🐳  gforghetti:[~] $ docker container exec -it centos sh -c 'ps'
  PID TTY          TIME CMD
    6 pts/0    00:00:00 ps
🐳  gforghetti:[~] $

Hello @gforghetti,

Your question pointed me in the right direction. The problem was not the container creation + startup - it was a script that I was running on it after this process.
If I created the container blank without anything, it worked fine.

I corrected the script, and now it works fine.
Sometimes you just need the right question to fix the issue :slight_smile:

Thanks a lot again!

Excellent! Glad you got past the problem.