Skip to content
Home » How to get bash or SSH into a running docker container

How to get bash or SSH into a running docker container

To get bash or SSH into a running docker container use the docker exec command. The docker exec command will open up a new terminal with new instance of the current container.

So, run the below command to SSH into a running docker container in background:

sudo docker exec -it <container_id> /bin/bash

Example: Suppose your container id is b2e34e167a3 then use:

sudo docker exec -it b2e34e167a3 /bin/bash

Also Read:

How to upgrade a single package using apt-get
Remove All Stopped Docker Containers