Playbooks
How to use the built-in Ansible playbook to manage Docker and quick reference for common management commands.
The Docker module provides a default playbook docker.yml for installing Docker Daemon and Docker Compose.
docker.yml
Playbook source file: docker.yml
Running this playbook will install docker-ce and docker-compose-plugin on target nodes with the docker_enabled: true flag, and enable the dockerd service.
The following are the available task subsets in the docker.yml playbook:
docker_install: Install Docker and Docker Compose packages on the nodedocker_admin: Add specified users to the Docker admin user groupdocker_alias: Generate Docker command completion and alias scriptsdocker_dir: Create Docker related directoriesdocker_config: Generate Docker daemon service configuration filedocker_launch: Start the Docker daemon servicedocker_register: Register Docker daemon as a Prometheus monitoring targetdocker_image: Attempt to load pre-cached image tarballs from/tmp/docker/*.tgz(if they exist)
The Docker module does not provide a dedicated uninstall playbook. If you need to uninstall Docker, you can manually stop Docker and then remove it:
systemctl stop docker # Stop Docker daemon service
yum remove docker-ce docker-compose-plugin # Uninstall Docker on EL systems
apt remove docker-ce docker-compose-plugin # Uninstall Docker on Debian systems
Feedback
Was this page helpful?
Thanks for the feedback! Please let us know how we can improve.
Sorry to hear that. Please let us know how we can improve.