Docker Ansible provides Ansible inside Docker for consistent running on your local machine or CI/CD system. You can view CHANGELOG to understand what changes have happened to this recently.
Visit the project documentation to make docker-ansible easier to use, extend, and contribute to.
These are the latest Ansible Core versions running within the containers:
- Ansible 2.18: 2.18.19
- Ansible 2.19: 2.19.14
- Ansible 2.20: 2.20.10
- Ansible 2.21: 2.21.5
- Older versions are provided within the unmaintained section, including 2.9, 2.10, 2.11, 2.12, 2.13, 2.14, 2.15, 2.16 and 2.17.
- More availability on Ansible versions on Ansible Release Documentation and Ansible-core to Python compatibility.
There are a number of immutable images that are also being collected. To find a specific version of Ansible, look within the Docker Hub Tags. Each of the containers follow a similar pattern: Ansible-version-Base OS version.
This includes:
ansible-core(https://pypi.org/project/ansible-core/)ansible(https://pypi.org/project/ansible/)ansible-lint(https://pypi.org/project/ansible-lint/)
Current images generally publish AMD64 and ARM64 variants, but platform availability is specific to each tag. Ubuntu 24.04 is currently AMD64-only, and no ARMv7/32-bit ARM images are published. Alpine-based images are supported from Alpine 3.21 onward; older Alpine releases are listed in older-releases.
| Base Image (↓) \ Ansible Version (→) | Dockerfile | 2.21 | 2.20 | 2.19 | 2.18 |
|---|---|---|---|---|---|
| Latest | Dockerfile | latest |
|||
| Alpine | Dockerfile | alpine |
|||
| Ubuntu | Dockerfile | ubuntu |
|||
| Alpine 3.21 | Dockerfile | 2.21-alpine-3.21 |
2.20-alpine-3.21 |
2.19-alpine-3.21 |
2.18-alpine-3.21 |
| Alpine 3.22 | Dockerfile | 2.21-alpine-3.22 |
2.20-alpine-3.22 |
2.19-alpine-3.22 |
2.18-alpine-3.22 |
| Alpine 3.23 | Dockerfile | 2.21-alpine-3.23 |
2.20-alpine-3.23 |
2.19-alpine-3.23 |
2.18-alpine-3.23 |
| Alpine 3.24 | Dockerfile | 2.21-alpine-3.24 |
2.20-alpine-3.24 |
2.19-alpine-3.24 |
2.18-alpine-3.24 |
| Bookworm (Debian 12) | Dockerfile | 2.19-debian-bookworm |
2.18-debian-bookworm |
||
| Bookworm Slim (Debian 12) | Dockerfile | 2.19-debian-bookworm-slim |
2.18-debian-bookworm-slim |
||
| Trixie (Debian 13) | Dockerfile | 2.21-debian-trixie |
2.20-debian-trixie |
2.19-debian-trixie |
2.18-debian-trixie |
| Trixie Slim (Debian 13) | Dockerfile | 2.21-debian-trixie-slim |
2.20-debian-trixie-slim |
2.19-debian-trixie-slim |
2.18-debian-trixie-slim |
| Rocky Linux 10 | Dockerfile | 2.21-rockylinux-10 |
2.20-rockylinux-10 |
2.19-rockylinux-10 |
2.18-rockylinux-10 |
| Ubuntu 24.04 | Dockerfile | 2.21-ubuntu-24.04 |
2.20-ubuntu-24.04 |
2.19-ubuntu-24.04 |
2.18-ubuntu-24.04 |
| Ubuntu 26.04 | Dockerfile | 2.21-ubuntu-26.04 |
2.20-ubuntu-26.04 |
OS:
- Rockylinux 9
- Debian Bullseye
- Ubuntu 20.04
Ansible-core:
- Ansible 2.12: ...
- Ansible 2.13: 2.13.13
- Ansible 2.14: 2.14.18
- Ansible 2.15: 2.15.13
- Ansible 2.16: 2.16.19
- Ansible 2.17: 2.17.14
Various older versions are available in the older-releases documentation.
Note: You will likely need to mount required directories into your container to make it run (or build on top of what is here).
Note: Containers run as the non-root
ansibleuser (UID/GID 1000) by default. Files written to mounted volumes will be owned by UID 1000, and SSH keys should be mounted into/home/ansible/.ssh/. If you need root inside the container (e.g. to install extra packages), pass--user roottodocker run.
docker run --rm -it willhallonline/ansible:latest /bin/shdocker run --rm -it -v $(pwd):/ansible -v ~/.ssh/id_rsa:/home/ansible/.ssh/id_rsa willhallonline/ansible:latest /bin/shdocker run --rm -it -v $(pwd):/ansible -v ~/.ssh/id_rsa:/home/ansible/.ssh/id_rsa willhallonline/ansible:latest ansible-playbook playbook.ymlYou can put these inside your dotfiles (~/.bashrc or ~/.zshrc to make handy aliases).
alias docker-ansible-cli='docker run --rm -it -v $(pwd):/ansible -v ~/.ssh/id_rsa:/home/ansible/.ssh/id_rsa --workdir=/ansible willhallonline/ansible:latest /bin/sh'
alias docker-ansible-cmd='docker run --rm -it -v $(pwd):/ansible -v ~/.ssh/id_rsa:/home/ansible/.ssh/id_rsa --workdir=/ansible willhallonline/ansible:latest 'use with:
docker-ansible-cli
docker-ansible-cmd ansible-playbook playbook.ymlTo accelerate using Mitogen look into Using Mitogen.
- Written and maintained by Will Hall