This commit is contained in:
Jack Moore 2024-12-23 13:04:49 -05:00
commit a2ef2a9c2b
3 changed files with 43 additions and 0 deletions

27
Dockerfile Normal file
View File

@ -0,0 +1,27 @@
FROM ubuntu:20.04
RUN apt update && apt install -y --no-install-recommends \
openssh-server sudo \
systemd systemd-sysv dbus dbus-user-session \
software-properties-common
RUN useradd -rm -d /home/ubuntu -s /bin/bash -g root -G sudo -u 1000 ubuntu
RUN echo 'ubuntu:Password123' | chpasswd
RUN echo 'root:root' | chpasswd
RUN printf '#!/bin/sh\nexit 0' > /usr/sbin/policy-rc.d
RUN printf "systemctl start systemd-logind" >> /etc/profile
RUN add-apt-repository "ppa:deadsnakes/ppa"
RUN apt update -y
RUN apt install -y python3.11
RUN service ssh start
EXPOSE 22
CMD ["/bin/bash", "-c", "/sbin/init", "&&", "/usr/sbin/sshd","-D"]

11
README.md Normal file
View File

@ -0,0 +1,11 @@
# Docker Ansible Testing
This repo is to spin up a docker container that runs systemd and openssh to be able to test out ansible playbooks on it.
Getting Started:
```sh
docker build -t dat:latest .
docker run -it --privileged --cap-add=ALL -p 10022:22 --rm -d dat:latest
```

5
entrypoint.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
/sbin/init &
/usr/sbin/sshd -D