How to open multiple terminals in docker?
You can run docker exec -it <container> bash
from multiple terminals to launch several sessions connected to the same container.
docker run -it container_name bash
starts a new container with bash promt.
docker exec -it container_name bash
joins already running container's bash prompt.
To expand on @eltonStoneman's great answer (For all those new docker folks like me):
Open a docker terminal
Get the image running as a container in the background:
docker run -d -it <image_id>
- Tip:
docker ps
will show the container_id that you just fired up from said image.
- Per @eltonStoneman's advice:
docker exec -it <container_id> bash
- Now your docker terminal is showing an interactive terminal to the container.
- Open up another terminal and perform step 3 to create another interactive terminal to the container. (Rinse and Repeat)
First get the name of the container
docker container ls
Then get run docker exec command to get in that container
docker exec <container_id> bash