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.
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.
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
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