Tutorials  Articles  Notifications  Login  Signup


RK

Rajan Kumar

Founder at HackersFriend Jan. 22, 2023, 8:38 p.m. ⋅ 1913 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

or

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>

 or

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