From a2ef2a9c2ba71f9ea3c3a230602394397d4e4b73 Mon Sep 17 00:00:00 2001 From: Jack Moore Date: Mon, 23 Dec 2024 13:04:49 -0500 Subject: [PATCH] init --- Dockerfile | 27 +++++++++++++++++++++++++++ README.md | 11 +++++++++++ entrypoint.sh | 5 +++++ 3 files changed, 43 insertions(+) create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9aa80ed --- /dev/null +++ b/Dockerfile @@ -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"] + + diff --git a/README.md b/README.md new file mode 100644 index 0000000..36030d9 --- /dev/null +++ b/README.md @@ -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 +``` diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..ae13cbb --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +/sbin/init & +/usr/sbin/sshd -D +