This tutorial shows how to connect to a docker container without stoping it when exiting.
docker exec -it containername bash
Here an example showing a container named apache running in docker.
We connect to it, exit the container,
then we check that the container is still running in docker.
root@ubuntu:~# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 574a0820f181 om:apache "/bin/bash" 3 days ago Up 2 days 0.0.0.0:80->80/tcp apache root@ubuntu:~# docker exec -it apache bash [root@574a0820f181 /]# exit exit root@ubuntu:~# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 574a0820f181 om:apache "/bin/bash" 3 days ago Up 2 days 0.0.0.0:80->80/tcp apache root@ubuntu:~#