1
0
mirror of https://github.com/phusion/baseimage-docker.git synced 2026-03-25 20:07:55 +00:00

Introduce the docker-bash tool.

This is a shortcut tool for logging into a container using SSH. Usage: `docker-bash <CONTAINER_ID>`.
This commit is contained in:
Hongli Lai (Phusion)
2014-06-17 17:36:28 +02:00
parent 9db4f43b74
commit 0b468fb61b
4 changed files with 115 additions and 0 deletions

View File

@@ -50,6 +50,7 @@ You can configure the stock `ubuntu` image yourself from your Dockerfile, so why
* [Using the insecure key for one container only](#using_the_insecure_key_for_one_container_only)
* [Enabling the insecure key permanently](#enabling_the_insecure_key_permanently)
* [Using your own key](#using_your_own_key)
* [The `docker-bash` tool](#docker_bash)
* [Disabling SSH](#disabling_ssh)
* [Building the image yourself](#building)
* [Conclusion](#conclusion)
@@ -358,6 +359,27 @@ Now SSH into the container as follows:
ssh -i /path-to/your_key root@<IP address>
<a name="docker_attach"></a>
#### The `docker-bash` tool
Looking up the IP of a container and running an SSH command quickly becomes tedious. Luckily, we provide the `docker-bash` tool which automates this process. This tool is to be run on the *Docker host*, not inside a Docker container.
First, install the tool on the Docker host:
curl --fail -L -O https://github.com/phusion/baseimage-docker/archive/master.tar.gz && \
tar xzf master.tar.gz && \
sudo ./baseimage-docker-master/install-tools.sh
Then run the tool as follows to login to a container using SSH:
docker-bash YOUR-CONTAINER-ID
You can lookup `YOUR-CONTAINER-ID` by running `docker ps`.
By default, `docker-bash` will open a Bash session. You can also tell it to run a command, and then exit:
docker-bash YOUR-CONTAINER-ID echo hello world
<a name="building"></a>
## Building the image yourself