Docker: getting a shell on a running container – use exec

1. either use exec

docker exec -it <container id> sh

 

2. or ssh

https://stackoverflow.com/questions/30172605/how-do-i-get-into-a-docker-container

 

E.g. build image:

docker build -f <Dockerfile name> -t <your tag> .

Docker: build

 

run it:

docker container run -d <name of repo> sleep 1d

docker container run

 

Then, list containers with docker ps to get container ID.

Leave a Reply

Your email address will not be published. Required fields are marked *