Search code examples
bashdockerexecbin

How to run /bin/bash in a docker container?


How to run /bin/bash in a docker container that was started with the -d option, for example:

sudo docker run -P --name test-cnt3 -d base-tst:0.1? 

I really need a console in the container and I already despaired of running it


Solution

  • Use docker exec to run a command in an already running container, use -it to create a new interactive pseudo-TTY:

    docker exec -it test-cnt3 /bin/bash