DK1
(DK)
1
Hi,
I’m looking for a Docker image to run some playbook and roles with the latest Ansible version?
I tried build my own but I’m not a python user.
FROM python:3.6.4-alpine3.7
RUN apk --update add git
WORKDIR /opt
RUN git clone https://github.com/ansible/ansible.git --recursive
WORKDIR /opt/ansible
RUN sh -c ‘source ./hacking/env-setup’
RUN pip install -r ./requirements.txt
WORKDIR /
RUN ansible --version
CMD [“sh”]
Getting the following with pip install -r ./requirements.txt
sivel
(sivel)
2
We do not package ansible in docker containers. There may be unofficial containers, but nothing official.
Doing so is easy enough though, and I do it for a personal project, you can see a Dockerfile at https://github.com/sivel/ansible-template-ui/blob/master/docker/devel/Dockerfile for building it.
My linked Dockerfile is also built to work with alpine.
Hi,
If you are running on Linux or macOS, you can also setup a pyenv [1] to create an isolated Python/pip environment to run Ansible.
Thanks,
-John
[1]: https://github.com/pyenv/pyenv