Is it possible to start a shell session in a running container (without ssh)

With docker 1.3, there is a new command docker exec. This allows you to enter a running docker:

docker exec -it "id of running container" bash

EDIT: Now you can use docker exec -it "id of running container" bash (doc)

Previously, the answer to this question was:

If you really must and you are in a debug environment, you can do this: sudo lxc-attach -n <ID> Note that the id needs to be the full one (docker ps -notrunc).

However, I strongly recommend against this.

notice: -notrunc is deprecated, it will be replaced by --no-trunc soon.


Just do

docker attach container_name

As mentioned in the comments, to detach from the container without stopping it, type Ctrlpthen Ctrlq.