Skip to content

Instantly share code, notes, and snippets.

@matachi
Created December 11, 2013 21:21
Show Gist options
  • Save matachi/7918664 to your computer and use it in GitHub Desktop.
Save matachi/7918664 to your computer and use it in GitHub Desktop.
Install sshd and automatically start it when starting a container. For example: `sudo docker build -t test . && sudo docker run -t -i -p 1337:22 test`
FROM ubuntu
RUN apt-get update
RUN apt-get install -y openssh-server
RUN mkdir /var/run/sshd
RUN echo 'root:pass' | chpasswd
CMD /usr/sbin/sshd && bash
@tomdantuit
Copy link

depending on the version of openssh, you'll typically receive an error saying that the run directory /run/sshd doesn't exist when trying to call /usr/sbin/sshd. This error can simply be resolved by making that directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment