Skip to content

Instantly share code, notes, and snippets.

@i-sync
Last active June 5, 2019 15:25
Show Gist options
  • Select an option

  • Save i-sync/3dd3e2bfd3a6e081b1d29d9b4ded0c67 to your computer and use it in GitHub Desktop.

Select an option

Save i-sync/3dd3e2bfd3a6e081b1d29d9b4ded0c67 to your computer and use it in GitHub Desktop.
Costom Ubuntu docker file - sshd python3 nginx etc
#build command
docker build -t ubuntu_sshd .
#run command
docker run \
-d \
--name ubuntu \
-p 81:80 \
-p 22:22 \
ubuntu_sshd
FROM ubuntu
RUN apt update \
&& apt install -y wget curl git net-tools python3 python3-distutils nginx vim htop openssh-server \
&& mkdir -p /root/download && cd /root/download \
&& wget https://bootstrap.pypa.io/get-pip.py \
&& python3 get-pip.py \
&& pip install virtualenv \
&& mkdir -p /var/run/sshd \
&& echo 'root:123' |chpasswd \
&& echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
#&& sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config \
#&& sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
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