Difference between revisions of "Install ssh in a docker container"

From MyWiki
Jump to: navigation, search
Line 1: Line 1:
 
'''Reference:'''    https://dev.to/s1ntaxe770r/how-to-setup-ssh-within-a-docker-container-i5i <br>
 
'''Reference:'''    https://dev.to/s1ntaxe770r/how-to-setup-ssh-within-a-docker-container-i5i <br>
  
The Dockerfile<br>
+
'''The Dockerfile:'''<br>
 
<source lang="bash">
 
<source lang="bash">
 
FROM ubuntu:latest
 
FROM ubuntu:latest

Revision as of 09:41, 9 June 2023

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"]