How do I get into a Docker container?

0 votes

I recently started working with docker. I'm using the WordPress base image and docker-compose.

I'm trying to ssh into one of the containers to inspect the files/directories that were created during the initial build. I tried to run docker-compose run containername ls -la, but that didn't do anything. Even if it did, I'd rather have a console where I can traverse the directory structure, rather than run a single command. What is the right way to do this with Docker?

Aug 10, 2018 in Docker by Hannah
• 14,080 points
36 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

docker attach will let you connect to your Docker container, but this isn't really the same thing as ssh. If your container is running a webserver, for example, docker attach will probably connect you to the stdout of the web server process. It won't necessarily give you a shell.

Use the docker exec command is probably what you are looking for; this will let you run arbitrary commands inside an existing container. For example:

docker exec -it <mycontainer> bash

answered Aug 10, 2018 by Kalgi
• 35,800 points

Related Questions In Docker

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,250 points
685 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,250 points
30 views
0 votes
1 answer
0 votes
1 answer

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

You can try the following step: You have ...READ MORE

answered Sep 7, 2018 in Docker by Damon Salvatore
• 5,250 points
195 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,120 points
57 views
+2 votes
11 answers
0 votes
2 answers

How to edit file after I shell to a docker container?

You can even install it using a ...READ MORE

answered Apr 23 in Docker by Ashish
1,713 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.