I have a question regarding Docker exec and Docker attach comands.
I have the following containers:
[root@taurus01 ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6718c09be711 alpine:latest “sleep 1d” 26 minutes ago Up 26 minutes myservice.1.ogjjv697mmxiqlresjsmjvc7t
cd9fc97a74aa busybox “sh” 2 weeks ago Up 4 hours container2
5f0a41b5d329 busybox “sh” 2 weeks ago Up 4 hours container1
For the busybox image I can use the command “docker attach container1” for example. But for the alpine:latest if I use that the comand window will became irresponsive.
I need to use instead docker exec -it 6718c09be711 sh.
Why is that? Are not all of them containers? Thanks.