From feecacfdf21be5d389402cc2111f06e26c1ba311 Mon Sep 17 00:00:00 2001 From: Sameer Naik Date: Tue, 25 Nov 2014 10:47:08 +0530 Subject: [PATCH] readme: document use of `docker exec` for shell access --- README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1210977..0b974d5 100644 --- a/README.md +++ b/README.md @@ -185,11 +185,17 @@ psql -U postgres -h $(docker inspect --format {{.NetworkSettings.IPAddress}} pos # Shell Access -For debugging and maintenance purposes you may want access the container shell. Since the container does not allow interactive login over the SSH protocol, you can use the [nsenter](http://man7.org/linux/man-pages/man1/nsenter.1.html) linux tool (part of the util-linux package) to access the container shell. +For debugging and maintenance purposes you may want access the containers shell. If you are using docker version `1.3.0` or higher you can access a running containers shell using `docker exec` command. + +```bash +docker exec -it postgresql bash +``` + +If you are using an older version of docker, you can use the [nsenter](http://man7.org/linux/man-pages/man1/nsenter.1.html) linux tool (part of the util-linux package) to access the container shell. Some linux distros (e.g. ubuntu) use older versions of the util-linux which do not include the `nsenter` tool. To get around this @jpetazzo has created a nice docker image that allows you to install the `nsenter` utility and a helper script named `docker-enter` on these distros. -To install the nsenter tool on your host execute the following command. +To install `nsenter` execute the following command on your host, ```bash docker run --rm -v /usr/local/bin:/target jpetazzo/nsenter @@ -203,8 +209,6 @@ sudo docker-enter postgresql For more information refer https://github.com/jpetazzo/nsenter -Another tool named `nsinit` can also be used for the same purpose. Please refer https://jpetazzo.github.io/2014/03/23/lxc-attach-nsinit-nsenter-docker-0-9/ for more information. - # Upgrading To upgrade to newer releases, simply follow this 3 step upgrade procedure.