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

1. either use exec

docker exec -it <container id> sh


2. or ssh


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 *