Last active
March 12, 2024 18:02
-
-
Save nnzv/5f9a88e7a9f8ad3d9525176e8d765aea to your computer and use it in GitHub Desktop.
Enable SSH connection in a container.
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:20.04 | |
RUN apt-get update \ | |
&& apt-get install -y --no-install-recommends \ | |
openssh-server \ | |
&& mkdir -p /run/sshd \ | |
&& echo "root:auth" | chpasswd \ | |
&& sed -i 's/^#\(PermitRootLogin\) .*/\1 yes/' /etc/ssh/sshd_config \ | |
&& sed -i 's/^\(UsePAM yes\)/# \1/' /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