31 Dec 2013

Ubuntu 13.10 stephens/sshd Docker Image

Here are some quick notes on using my Ubuntu 13.10 docker image with ssh pre-installed. In a previous post I described how I built this image.

Download The Image

I've posted the stephens/sshd image to the docker site and  you can download it with the command:

docker pull stephens/sshd

The root password is password.

Quick Test

For a quick test of the image, execute this command:

sudo docker run -d -p 22 stephens/sshd

To connect to the image, you need to find out the port number that docker has mapped ssh to with the docker ps command. Under PORTS you should see something like this:

0.0.0.0:49176->22/tcp

This shows that ssh has been mapped to port 49176. Now test the ssh connection with the ssh command and use password as the password to login

ssh root@localhost -p <portnum>

After connecting I suggest you change the password and then commit a copy of the running container to save the new password to the image:

docker commit -run='{"Cmd": ["/usr/sbin/sshd","-D"], "PortSpecs": ["22"]}' c3c75a870311 stephens/sshd

Selecting The Port

I'd prefer to select the external port for ssh and there's a good explanation of port mapping on the docker site describing how to do this. Here's the syntax to start the image and map 22 to 8022.

sudo docker run -d -p 8022:22 stephens/sshd

 


Tags:
0 comments