Difference between revisions of "Install ssh in a docker container"
From MyWiki
(Created page with "'''Reference:''' https://dev.to/s1ntaxe770r/how-to-setup-ssh-within-a-docker-container-i5i <br>") |
|||
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> | ||
+ | <source lang="bash"> | ||
+ | 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"] | ||
+ | </source> |
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"]