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
41 views

1 answer 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

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
• 37,320 points
45 views
0 votes
1 answer

How do I run a docker image as a container?

You can run an image depends on whether you ...READ MORE

answered Sep 7, 2018 in Docker by Damon Salvatore
• 5,490 points
56 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,160 points
99 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,490 points
1,460 views
+2 votes
11 answers