I have a container that is running the Apache service in the foreground. I would like to be able to access the container from another shell in order to "poke around" inside it and examine the files. At the moment, if I attach to the container, I am left looking at the Apache daemon and cannot run any commands.
Is it possible to attach another tty to a running container? Possibly, I can take advantage of the fact that Docker is actually just wrapping around LXC containers? I have tried sudo lxc-console -n [container-id] -t [1-4]
but it appears that only one tty is made available and that is the one running the apache daemon. Perhaps there is a way to enable multiple lxc consoles during the build?
I would rather not configure and build the container with an openssh service if possible.
The SSH method works fine for Docker containers, too. That said, you can SSH into a Docker container using Docker's built-in docker exec . If you do not need an interactive shell, you can also use the docker attach command to connect the host's stdin and stdout to the running container and execute remote commands.
The answer is yes!! But using normal docker run commands, you won't be able to see or interact with the these applications. You need to connect the display with the container in order to do so.
With docker 1.3, there is a new command docker exec
. This allows you to enter a running container:
docker exec -it [container-id] bash
Note: this assumes bash
is installed on your container. You may run sh
or whatever interactive shell is installed on 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