Created
April 26, 2022 03:42
-
-
Save zrod/e852edba46e6d83f8adef4020cd437da to your computer and use it in GitHub Desktop.
Ansible - docker container as sandbox
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
version: '3' | |
services: | |
server: | |
build: . | |
ports: | |
- '2222:22' |
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 update \ | |
&& apt -y upgrade \ | |
&& apt install -y openssh-server vim | |
RUN useradd -rm -d /home/zrod -s /bin/bash -g root -G sudo -u 1000 zrod \ | |
&& echo 'zrod:mysafepassword' | chpasswd \ | |
&& usermod -aG sudo zrod | |
COPY zrod_ed25519.pub /home/zrod/.ssh/authorized_keys | |
RUN chown -R zrod: /home/zrod/.ssh \ | |
&& chmod 600 /home/zrod/.ssh/authorized_keys | |
RUN service ssh start | |
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
On Mac: