I'm using below command to run docker,
docker run -it centos:6.5 bash
It starts bash with root user, no problem.
But I wish to have multiple terminals to connect to it and do different things. I found attach
command will only duplicate a terminal window which all input/output will be propagated. It doesn't solve my requirement.
How to do this?
Once the container is running, you should be able to use docker exec
to run an additional Bash session in the same container.
When your first container is running, use docker ps
to find its Container ID (the first column in the docker ps
output), e.g. 4a7afcdeb729
, then run the following:
docker exec -it 4a7afcdeb729 bash
This should open a new terminal session in the container.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With