I am trying to create an image which contains an openssh server and start it when invoking the run command. I have taken the following steps:
docker pull ubuntu
docker run -d -it ubuntu bash
apt-get update
apt-get install openssh-server -y
exit
docker ps -a
docker commit <CONTAINER ID> myimg
// tried the following three, same results
docker run -d myimg "/usr/sbin/sshd"
docker run -d myimg /usr/sbin/sshd -D
docker run -d myimg service ssh start
This runs the image then exits immediately, I am trying to get the service to keep up. What Am I doing wrong?
Figured it out. You must create a directory after installing openssh-server.
The error:
Missing privilege separation directory: /var/run/sshd