How do i ssh into a running conatiner?

0 votes

Suppose, I have two containers and I wish to execute certain commands only on the first container. How do i ssh into a running container?

Mar 12 in Docker by david
52 views

2 answers to this question.

0 votes

There is a docker exec command that can be used to connect to a container that is already running.

  • Use docker ps to get the name of the existing container
  • Use the command docker exec -it <container name> /bin/bash to get a bash shell in the container
  • Generically, use docker exec -it <container name> <command> to execute whatever command you specify in the container.
answered Mar 12 by Jason
0 votes

To bash into a running container,you could use the following command:

docker exec -it container_name /bin/bash
answered Aug 9 by Sirajul
• 25,220 points

Related Questions In Docker

+1 vote
1 answer
0 votes
1 answer

How do I get into a Docker container?

docker attach will let you connect to your ...READ MORE

answered Aug 10, 2018 in Docker by Kalgi
• 40,440 points
59 views
0 votes
2 answers

How do I force Docker for a clean build of an image ?

You could try this inorder to clean ...READ MORE

answered Aug 6 in Docker by Sirajul
• 25,220 points
1,010 views
0 votes
1 answer
0 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 56,520 points
153 views
0 votes
1 answer

How do I copy a file from docker container to host?

Here is a way which you can ...READ MORE

answered Aug 27, 2018 in Docker by Damon Salvatore
• 5,510 points
2,397 views
0 votes
2 answers

How do I run a docker image as a container?

You could probably follow these steps : $ docker ...READ MORE

answered Aug 9 in Docker by Sirajul
• 25,220 points
88 views