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
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
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
If you use docker-composer or Dockerfile look at Entrypoint & CMD
And to connect use
sudo docker attach awesome-container
In my case, docker exec -it test /bin/bash
gave me
Error response from daemon: Container f63bba8... is not running
When I tried
docker start test
the container started, but trying exec again threw the same error as before.
In the end, I had to enter
docker run -it test /bin/bash
This starts the bash right before the container stops.
© 2022 - 2024 — McMap. All rights reserved.