Skip to content
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

48 lines (35 sloc) 1.37 KB
FROM ubuntu:14.04
MAINTAINER Chu-Siang Lai <>
# Update the index of available packages.
RUN apt-get update
# Install the requires package.
RUN apt-get install -y openssh-server python sudo curl wget bash-completion openssl \
&& \
apt-get clean
# Setting the sshd.
RUN mkdir /var/run/sshd
RUN echo 'root:root' | chpasswd
RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s* optional' -i /etc/pam.d/sshd
ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile
# Create a new user.
# - username: docker
# - password: docker
RUN useradd --create-home --shell /bin/bash \
--password $(openssl passwd -1 docker) docker
# Add sudo permission.
RUN echo 'docker ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
# Setting ssh public key.
RUN wget \
-O /tmp/authorized_keys && \
mkdir /home/docker/.ssh && \
mv /tmp/authorized_keys /home/docker/.ssh/ && \
chown -R docker:docker /home/docker/.ssh/ && \
chmod 644 /home/docker/.ssh/authorized_keys && \
chmod 700 /home/docker/.ssh
# Run ssh server daemon.
CMD ["/usr/sbin/sshd", "-D"]
You can’t perform that action at this time.