Skip to content

Instantly share code, notes, and snippets.

@mdrokz
Created October 8, 2021 08:13
Show Gist options
  • Save mdrokz/76bb08ea3adfe10220efee7c6af8ae2c to your computer and use it in GitHub Desktop.
Save mdrokz/76bb08ea3adfe10220efee7c6af8ae2c to your computer and use it in GitHub Desktop.
Dockerfile for building alpine container that has sshd enabled
FROM alpine:latest
RUN apk add -U openssh sudo wireguard-tools
RUN echo -e "Port 2222\n" >> /etc/ssh/sshd_config
RUN echo '%wheel ALL=(ALL) ALL' > /etc/sudoers.d/wheel
RUN adduser --disabled-password test wheel
RUN echo 'test ALL=(ALL) ALL' >> /etc/sudoers
RUN echo 'test:admin@123' | chpasswd
RUN cd /etc/ssh && ssh-keygen -A
EXPOSE 2222
CMD ["/usr/sbin/sshd", "-e", "-D"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment