Tutorials  Articles  Notifications  Login  Signup


Rajan Kumar

Founder at HackersFriend Jan. 22, 2023, 8:38 p.m. ⋅ 1483 views

How to get inside docker container shell ?

To get inside a running docker container you can use below command:

docker exec -it <container id> bash


docker exec -it <container id> sh

In case your image is not running, you might not have container id, instead you might be having image name. To run a docker image and get inside the shell on start, you can use below command:

docker run --rm -it --entrypoint /bin/bash <image_name>


docker run --rm -it --entrypoint /bin/sh <image_name>


HackerFriend Logo

Join the community of 1 Lakh+ Developers

Create a free account and get access to tutorials, jobs, hackathons, developer events and neatly written articles.

Create a free account