Skip to content

Instantly share code, notes, and snippets.

@jeffbrl
Created February 10, 2017 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffbrl/05fb5f98e773a6f2336ec416113f865e to your computer and use it in GitHub Desktop.
Save jeffbrl/05fb5f98e773a6f2336ec416113f865e to your computer and use it in GitHub Desktop.
Dockerfile for ssh container
# based on Duke Dougal's post at http://superuser.com/questions/844101/docker-login-via-ssh-always-asks-for-password
FROM ubuntu:trusty
ENV USER ubuntu
RUN apt-get update && apt-get install -y openssh-server
RUN mkdir /var/run/sshd
RUN adduser --disabled-password --gecos "" $USER
RUN adduser $USER sudo
ADD authorized_keys /home/$USER/.ssh/authorized_keys
RUN chown $USER /home/$USER/.ssh/authorized_keys
RUN chown -R $USER:$USER /home/$USER/.ssh/authorized_keys
RUN chmod 700 /home/$USER/.ssh/authorized_keys
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment