Skip to content

Instantly share code, notes, and snippets.

@brycepg
Last active December 15, 2023 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brycepg/cce020f09f47ba95f628be6f190b3e0c to your computer and use it in GitHub Desktop.
Save brycepg/cce020f09f47ba95f628be6f190b3e0c to your computer and use it in GitHub Desktop.
ansible docker container
FROM ubuntu:22.04
EXPOSE 22
EXPOSE 5984
RUN apt-get update && apt-get install -y openssh-server sudo
COPY --chown=root:root authorized_keys /root/.ssh/authorized_keys
RUN chmod 0644 /root/.ssh/authorized_keys
ENTRYPOINT service ssh start && bash
@brycepg
Copy link
Author

brycepg commented Dec 13, 2023

Run with

sudo docker build -t sshd_image .
sudo docker run -it -d sshd_image

And then execute the ansible:

ansible-playbook --ask-vault-pass -i inventory.yml main.yml

If you want to bind the 5984 port to the parent OS:

sudo docker run -p 5984:5984 -it -d sshd_image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment