Created
September 15, 2020 15:15
-
-
Save hughshen/660c83cc7e91536a0fbcb12f47af918b to your computer and use it in GitHub Desktop.
Dockerize an SSH service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:18.04 | |
ARG USER=docker | |
ARG PASS=docker | |
ARG UID=1000 | |
ARG GID=1000 | |
RUN sed -i 's/\(archive\|security\).ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list \ | |
&& mkdir /var/run/sshd \ | |
&& apt-get update \ | |
&& apt-get install -y \ | |
git \ | |
vim \ | |
curl \ | |
wget \ | |
sudo \ | |
net-tools \ | |
openssh-server \ | |
&& apt-get clean \ | |
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* | |
RUN groupadd -g ${GID} ${USER} \ | |
&& useradd -rm -s /bin/bash -g ${GID} -G sudo -u ${UID} ${USER} \ | |
&& echo "${USER}:${PASS}" | chpasswd | |
CMD ["/usr/sbin/sshd", "-D"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment