Docker Community Forums

Share and learn in the Docker community.

Bash through Exec is not responding

Hi

When running an exec from my host it runs ok

root@server50:~# docker exec -t rsnapshot ping -c 2 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: icmp_seq=0 ttl=118 time=10.338 ms
64 bytes from 8.8.8.8: icmp_seq=1 ttl=118 time=10.657 ms
--- 8.8.8.8 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max/stddev = 10.338/10.497/10.657/0.160 ms
root@server50:~#

When entering the container bash it does not run

root@server50:~# docker exec -t rsnapshot bash
root@26a7c3f28e12:/# ping -c 2 8.8.8.8

(I can wait 20 minutes... nothing is going to happen)

And it is the same for ANY command, like top

root@server50:~# docker exec -t rsnapshot bash
root@26a7c3f28e12:/# top

(I can wait 20 minutes... nothing is going to happen)

Any clue? Thanks!

Your first command doesn’t start a bash shell. It executes ping directly inside the container. Your second and third example on the other hand starts a bash shell with TTY (-t) without interactivity (-i). Try this way:

docker exec -it rsnapshot bash
$  ping -c 2 8.8.8.8
2 Likes

Argh! I always used docker exec -it rsnapshot bash.
I was blinded by someone else trying -t in the bash history.
Thanks for shedding a light @rimelek .