{"id":13510592,"url":"https://github.com/geerlingguy/ansible-role-docker","last_synced_at":"2025-05-14T00:08:20.875Z","repository":{"id":37706341,"uuid":"83000062","full_name":"geerlingguy/ansible-role-docker","owner":"geerlingguy","description":"Ansible Role - Docker","archived":false,"fork":false,"pushed_at":"2025-04-05T14:42:05.000Z","size":236,"stargazers_count":1991,"open_issues_count":17,"forks_count":885,"subscribers_count":38,"default_branch":"master","last_synced_at":"2025-04-10T22:17:32.972Z","etag":null,"topics":["ansible","centos","containers","debian","docker","infrastructure","management","redhat","role","server","ubuntu"],"latest_commit_sha":null,"homepage":"https://galaxy.ansible.com/geerlingguy/docker/","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/geerlingguy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"geerlingguy","patreon":"geerlingguy"}},"created_at":"2017-02-24T04:08:42.000Z","updated_at":"2025-04-10T14:12:33.000Z","dependencies_parsed_at":"2024-11-19T16:32:46.532Z","dependency_job_id":"bbc88c6e-c358-487f-94ba-1682e6f397c5","html_url":"https://github.com/geerlingguy/ansible-role-docker","commit_stats":{"total_commits":232,"total_committers":77,"mean_commits":3.012987012987013,"dds":0.5344827586206897,"last_synced_commit":"a9bd86ebad0d2aaa2180742552bfb3eca8dc816b"},"previous_names":[],"tags_count":70,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geerlingguy%2Fansible-role-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geerlingguy%2Fansible-role-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geerlingguy%2Fansible-role-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geerlingguy%2Fansible-role-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geerlingguy","download_url":"https://codeload.github.com/geerlingguy/ansible-role-docker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254043982,"owners_count":22005047,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","centos","containers","debian","docker","infrastructure","management","redhat","role","server","ubuntu"],"created_at":"2024-08-01T02:01:45.473Z","updated_at":"2025-05-14T00:08:15.859Z","avatar_url":"https://github.com/geerlingguy.png","language":null,"funding_links":["https://github.com/sponsors/geerlingguy","https://patreon.com/geerlingguy"],"categories":["Others","Unknow","ansible","ubuntu"],"sub_categories":[],"readme":"# Ansible Role: Docker\n\n[![CI](https://github.com/geerlingguy/ansible-role-docker/actions/workflows/ci.yml/badge.svg)](https://github.com/geerlingguy/ansible-role-docker/actions/workflows/ci.yml)\n\nAn Ansible Role that installs [Docker](https://www.docker.com) on Linux.\n\n## Requirements\n\nNone.\n\n## Role Variables\n\nAvailable variables are listed below, along with default values (see `defaults/main.yml`):\n\n```yaml\n# Edition can be one of: 'ce' (Community Edition) or 'ee' (Enterprise Edition).\ndocker_edition: 'ce'\ndocker_packages:\n    - \"docker-{{ docker_edition }}\"\n    - \"docker-{{ docker_edition }}-cli\"\n    - \"docker-{{ docker_edition }}-rootless-extras\"\ndocker_packages_state: present\n```\n\nThe `docker_edition` should be either `ce` (Community Edition) or `ee` (Enterprise Edition). \nYou can also specify a specific version of Docker to install using the distribution-specific format: \nRed Hat/CentOS: `docker-{{ docker_edition }}-\u003cVERSION\u003e` (Note: you have to add this to all packages);\nDebian/Ubuntu: `docker-{{ docker_edition }}=\u003cVERSION\u003e` (Note: you have to add this to all packages).\n\nYou can control whether the package is installed, uninstalled, or at the latest version by setting `docker_packages_state` to `present`, `absent`, or `latest`, respectively. Note that the Docker daemon will be automatically restarted if the Docker package is updated. This is a side effect of flushing all handlers (running any of the handlers that have been notified by this and any other role up to this point in the play).\n\n```yaml\ndocker_obsolete_packages:\n  - docker\n  - docker.io\n  - docker-engine\n  - docker-doc\n  - docker-compose\n  - docker-compose-v2\n  - podman-docker\n  - containerd\n  - runc\n```\n\n`docker_obsolete_packages` for different os-family:\n\n- [`RedHat.yaml`](./vars/RedHat.yml)\n- [`Debian.yaml`](./vars/Debian.yml)\n\nA list of packages to be uninstalled prior to running this role. See [Docker's installation instructions](https://docs.docker.com/engine/install/debian/#uninstall-old-versions) for an up-to-date list of old packages that should be removed.\n\n```yaml\ndocker_service_manage: true\ndocker_service_state: started\ndocker_service_enabled: true\ndocker_restart_handler_state: restarted\n```\n\nVariables to control the state of the `docker` service, and whether it should start on boot. If you're installing Docker inside a Docker container without systemd or sysvinit, you should set `docker_service_manage` to `false`.\n\n```yaml\ndocker_install_compose_plugin: true\ndocker_compose_package: docker-compose-plugin\ndocker_compose_package_state: present\n```\n\nDocker Compose Plugin installation options. These differ from the below in that docker-compose is installed as a docker plugin (and used with `docker compose`) instead of a standalone binary.\n\n```yaml\ndocker_install_compose: false\ndocker_compose_version: \"v2.32.1\"\ndocker_compose_arch: \"{{ ansible_architecture }}\"\ndocker_compose_url: \"https://github.com/docker/compose/releases/download/{{ docker_compose_version }}/docker-compose-linux-{{ docker_compose_arch }}\"\ndocker_compose_path: /usr/local/bin/docker-compose\n```\n\nDocker Compose installation options.\n\n```yaml\ndocker_add_repo: true\n```\n\nControls whether this role will add the official Docker repository. Set to `false` if you want to use the default docker packages for your system or manage the package repository on your own.\n\n```yaml\ndocker_repo_url: https://download.docker.com/linux\n```\n\nThe main Docker repo URL, common between Debian and RHEL systems.\n\n```yaml\ndocker_apt_release_channel: stable\ndocker_apt_arch: \"{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}\"\ndocker_apt_repository: \"deb [arch={{ docker_apt_arch }}{{' signed-by=/etc/apt/keyrings/docker.asc' if add_repository_key is not failed}}] {{ docker_repo_url }}/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}\"\ndocker_apt_ignore_key_error: True\ndocker_apt_gpg_key: \"{{ docker_repo_url }}/{{ ansible_distribution | lower }}/gpg\"\ndocker_apt_filename: \"docker\"\n```\n\n(Used only for Debian/Ubuntu.) You can switch the channel to `nightly` if you want to use the Nightly release.\n\nYou can change `docker_apt_gpg_key` to a different url if you are behind a firewall or provide a trustworthy mirror.\nUsually in combination with changing `docker_apt_repository` as well. `docker_apt_filename` controls the name of the source list file created in `sources.list.d`. If you are upgrading from an older (\u003c7.0.0) version of this role, you should change this to the name of the existing file (e.g. `download_docker_com_linux_debian` on Debian) to avoid conflicting lists.\n\n```yaml\ndocker_yum_repo_url: \"{{ docker_repo_url }}/{{ (ansible_distribution == 'Fedora') | ternary('fedora','centos') }}/docker-{{ docker_edition }}.repo\"\ndocker_yum_repo_enable_nightly: '0'\ndocker_yum_repo_enable_test: '0'\ndocker_yum_gpg_key: \"{{ docker_repo_url }}/{{ (ansible_distribution == 'Fedora') | ternary('fedora', 'centos') }}/gpg\"\n```\n\n(Used only for RedHat/CentOS.) You can enable the Nightly or Test repo by setting the respective vars to `1`.\n\nYou can change `docker_yum_gpg_key` to a different url if you are behind a firewall or provide a trustworthy mirror.\nUsually in combination with changing `docker_yum_repository` as well.\n\n```yaml\ndocker_users:\n  - user1\n  - user2\n```\n\nA list of system users to be added to the `docker` group (so they can use Docker on the server).\n\n```yaml\ndocker_daemon_options:\n  storage-driver: \"overlay2\"\n  log-opts:\n    max-size: \"100m\"\n```\n\nCustom `dockerd` options can be configured through this dictionary representing the json file `/etc/docker/daemon.json`.\n\n## Use with Ansible (and `docker` Python library)\n\nMany 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:\n\n```yaml\n- hosts: all\n\n  vars:\n    pip_install_packages:\n      - name: docker\n\n  roles:\n    - geerlingguy.pip\n    - geerlingguy.docker\n```\n\n## Dependencies\n\nNone.\n\n## Example Playbook\n\n```yaml\n- hosts: all\n  roles:\n    - geerlingguy.docker\n```\n\n## License\n\nMIT / BSD\n\n## Sponsors\n\n* [We Manage](https://we-manage.de): Helping start-ups and grown-ups scaling their infrastructure in a sustainable way.\n\nThe above sponsor(s) are supporting Jeff Geerling on [GitHub Sponsors](https://github.com/sponsors/geerlingguy). You can sponsor Jeff's work too, to help him continue improving these Ansible open source projects!\n\n## Author Information\n\nThis role was created in 2017 by [Jeff Geerling](https://www.jeffgeerling.com/), author of [Ansible for DevOps](https://www.ansiblefordevops.com/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeerlingguy%2Fansible-role-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeerlingguy%2Fansible-role-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeerlingguy%2Fansible-role-docker/lists"}