Install ssh in a docker container

From MyWiki
Revision as of 09:41, 9 June 2023 by George2 (Talk | contribs)

Jump to: navigation, search

Reference: https://dev.to/s1ntaxe770r/how-to-setup-ssh-within-a-docker-container-i5i

The Dockerfile

FROM ubuntu:latest
RUN apt update && apt install  openssh-server sudo -y
RUN useradd -rm -d /home/ubuntu -s /bin/bash -g root -G sudo -u 1000 test 
RUN  echo 'test:test' | chpasswd
RUN service ssh start
EXPOSE 22
CMD ["/usr/sbin/sshd","-D"]