readme: document use of docker exec for shell access

This commit is contained in:
Sameer Naik
2014-11-25 10:47:08 +05:30
parent df2638881b
commit feecacfdf2
+8 -4
View File
@@ -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.