An Ansible Role that installs Docker on Linux, specially tailored for ARM-based computers like the Raspberry Pi.
If you need a more flexible and generic role for Docker on non-ARM platforms like x86, please check out geerlingguy.docker
.
Besides the documentation here, please see the Raspberry Pi Dramble for an example of this role in action, being used with multiple Raspberry Pis to build a Kubernetes cluster, or Drupal Pi for an example of use with a single Raspberry Pi.
If installing Docker Compose, requires Python Pip already be installed (you can use geerlingguy.pip
to install it).
Available variables are listed below, along with default values (see defaults/main.yml
):
docker_version_armv7: 5:19.03.12~3-0~raspbian-buster
docker_version_arm64: 5:19.03.8~3-0~raspbian-buster
docker_version: "{{ docker_version_armv7 if 'armv7' in ansible_architecture else docker_version_arm64 }}"
The version of Docker to install. Check for available versions with apt-cache madison docker-ce
.
docker_install_recommends: false
Whether to install recommended packages alongside docker-ce.
docker_install_compose: true
Whether to install Docker Compose via Pip.
docker_users:
- user1
- user2
A list of system users to be added to the docker
group (so they can use Docker on the server).
docker_pip_executable: pip3
Set this to pip
for Python 2 or pip3
for Python 3.
Many users of this role wish to also use Ansible to then build Docker images and manage Docker containers on the server where Docker is installed. In this case, you can easily add in the docker
Python library using the geerlingguy.pip
role:
- hosts: rpi
vars:
pip_package: python3-pip
pip_install_packages:
- name: docker
roles:
- geerlingguy.pip
- geerlingguy.docker_arm
None.
- hosts: rpi
vars:
pip_package: python3-pip
roles:
- geerlingguy.pip
- geerlingguy.docker_arm
MIT / BSD
This role was created in 2019 by Jeff Geerling, author of Ansible for DevOps.