Community Docker Collection for Ansible: modules and plugins for working with Docker
Go to file
Felix Fontein f09a2540aa
Arch Linux switched to Python 3.12. (#842)
2024-04-28 19:07:19 +02:00
.azure-pipelines Arch Linux switched to Python 3.12. (#842) 2024-04-28 19:07:19 +02:00
.github CI: Add stable-2.17; copy ignore.txt files from 2.17 to 2.18; move stable-2.14 from AZP to GHA (#830) 2024-04-03 08:32:28 +02:00
.reuse Make reuse conformant (#462) 2022-08-21 08:29:15 +02:00
LICENSES Add proper platform handling. (#705) 2023-12-10 09:03:32 +01:00
changelogs Release 3.9.0 2024-04-21 16:20:52 +02:00
docs/docsite Include changelog in docsite (#837) 2024-04-18 12:50:33 +02:00
meta docker_compose_v2: allow to specify inline compose definitions (#832) 2024-04-09 17:41:12 +02:00
plugins Add check_files_existing option. (#839) 2024-04-21 16:01:07 +02:00
tests Remove unused code that relies on functionality deprecated in Python 3.12. (#834) 2024-04-15 11:21:46 +00:00
.gitignore Ignore PyCharm related files (#501) 2022-11-25 21:19:47 +01:00
CHANGELOG.md Release 3.9.0 2024-04-21 16:20:52 +02:00
CHANGELOG.md.license Add MarkDown changelog and use it by default. (#788) 2024-02-09 13:08:24 +01:00
CHANGELOG.rst Release 3.9.0 2024-04-21 16:20:52 +02:00
CHANGELOG.rst.license Make reuse conformant (#462) 2022-08-21 08:29:15 +02:00
COPYING Initial cleanup. 2020-10-30 07:05:51 +01:00
README.md CI: Add stable-2.17; copy ignore.txt files from 2.17 to 2.18; move stable-2.14 from AZP to GHA (#830) 2024-04-03 08:32:28 +02:00
galaxy.yml Next expected release is 3.10.0. 2024-04-21 16:51:15 +02:00

README.md

Docker Community Collection

Doc Build Status Codecov

This repo contains the community.docker Ansible Collection. The collection includes many modules and plugins to work with Docker.

Please note that this collection does not support Windows targets. The connection plugins included in this collection support Windows targets on a best-effort basis, but we are not testing this in CI.

Tested with Ansible

Tested with the current ansible-core 2.11, ansible-core 2.12, ansible-core 2.13, ansible-core 2.14, ansible-core 2.15, ansible-core 2.16, and ansible-core 2.17 releases, and the current development version of ansible-core. Ansible/ansible-base versions before 2.11.0 are not supported.

Please note that Ansible 2.9 and ansible-base 2.10 are no longer supported. If you need to use them, use community.docker 2.x.y. Also note that this collection does not work with ansible-core 2.11 (this includes ansible-base and Ansible 2.9) on Python 3.12+.

External requirements

Some modules and plugins require Docker CLI, or other external, programs. Some require the Docker SDK for Python and some use requests to directly communicate with the Docker daemon API. All modules and plugins require Python 2.7 or later. Python 2.6 is no longer supported; use community.docker 2.x.y if you need to use Python 2.6.

Installing the Docker SDK for Python also installs the requirements for the modules and plugins that use requests. If you want to directly install the Python libraries instead of the SDK, you need the following ones:

  • requests;
  • pywin32 when using named pipes on Windows with the Windows 32 API;
  • paramiko when using SSH to connect to the Docker daemon with use_ssh_client=false;
  • pyOpenSSL when using TLS to connect to the Docker daemon;
  • backports.ssl_match_hostname when using TLS to connect to the Docker daemon on Python 2.

If you have Docker SDK for Python < 2.0.0 installed (docker-py), you can still use it for modules that support it, though we recommend to uninstall it and then install docker, the Docker SDK for Python >= 2.0.0. Note that both libraries cannot be installed at the same time. If you accidentally did install them simultaneously, you have to uninstall both before re-installing one of them.

Collection Documentation

Browsing the latest collection documentation will show docs for the latest version released in the Ansible package, not the latest version of the collection released on Galaxy.

Browsing the devel collection documentation shows docs for the latest version released on Galaxy.

We also separately publish latest commit collection documentation which shows docs for the latest commit in the main branch.

If you use the Ansible package and do not update collections independently, use latest. If you install or update this collection directly from Galaxy, use devel. If you are looking to contribute, use latest commit.

Included content

  • Connection plugins:
    • community.docker.docker: use Docker containers as remotes using the Docker CLI program
    • community.docker.docker_api: use Docker containers as remotes using the Docker API
    • community.docker.nsenter: execute commands on the host running the controller container
  • Inventory plugins:
    • community.docker.docker_containers: dynamic inventory plugin for Docker containers
    • community.docker.docker_machine: collect Docker machines as inventory
    • community.docker.docker_swarm: collect Docker Swarm nodes as inventory
  • Modules:
    • Docker:
      • community.docker.docker_container: manage Docker containers
      • community.docker.docker_container_copy_into: copy a file into a Docker container
      • community.docker.docker_container_exec: run commands in Docker containers
      • community.docker.docker_container_info: retrieve information on Docker containers
      • community.docker.docker_host_info: retrieve information on the Docker daemon
      • community.docker.docker_image: manage Docker images
      • community.docker.docker_image_build: build Docker images using Docker buildx
      • community.docker.docker_image_export: export (archive) Docker images
      • community.docker.docker_image_info: retrieve information on Docker images
      • community.docker.docker_image_load: load Docker images from archives
      • community.docker.docker_image_pull: pull Docker images from registries
      • community.docker.docker_image_push: push Docker images to registries
      • community.docker.docker_image_remove: remove Docker images
      • community.docker.docker_image_tag: tag Docker images with new names and/or tags
      • community.docker.docker_login: log in and out to/from registries
      • community.docker.docker_network: manage Docker networks
      • community.docker.docker_network_info: retrieve information on Docker networks
      • community.docker.docker_plugin: manage Docker plugins
      • community.docker.docker_prune: prune Docker containers, images, networks, volumes, and build data
      • community.docker.docker_volume: manage Docker volumes
      • community.docker.docker_volume_info: retrieve information on Docker volumes
    • Docker Compose:
      • community.docker.docker_compose: manage Docker Compose files (legacy Docker Compose v1)
      • community.docker.docker_compose_v2: manage Docker Compose files (Docker compose CLI plugin)
      • community.docker.docker_compose_v2_pull: pull a Docker compose project
    • Docker Swarm:
      • community.docker.docker_config: manage configurations
      • community.docker.docker_node: manage Docker Swarm nodes
      • community.docker.docker_node_info: retrieve information on Docker Swarm nodes
      • community.docker.docker_secret: manage secrets
      • community.docker.docker_swarm: manage Docker Swarm
      • community.docker.docker_swarm_info: retrieve information on Docker Swarm
      • community.docker.docker_swarm_service: manage Docker Swarm services
      • community.docker.docker_swarm_service_info: retrieve information on Docker Swarm services
    • Docker Stack:
      • community.docker.docker_stack: manage Docker Stacks
      • community.docker.docker_stack_info: retrieve information on Docker Stacks
      • community.docker.docker_stack_task_info: retrieve information on tasks in Docker Stacks
    • Other:
      • current_container_facts: return facts about whether the module runs in a Docker container

Using this collection

Before using the Docker community collection, you need to install the collection with the ansible-galaxy CLI:

ansible-galaxy collection install community.docker

You can also include it in a requirements.yml file and install it via ansible-galaxy collection install -r requirements.yml using the format:

collections:
- name: community.docker

See Ansible Using collections for more details.

Contributing to this collection

If you want to develop new content for this collection or improve what is already here, the easiest way to work on the collection is to clone it into one of the configured COLLECTIONS_PATH, and work on it there.

You can find more information in the developer guide for collections, and in the Ansible Community Guide.

Release notes

See the changelog.

More information

Licensing

This collection is primarily licensed and distributed as a whole under the GNU General Public License v3.0 or later.

See LICENSES/GPL-3.0-or-later.txt for the full text.

Parts of the collection are licensed under the Apache 2.0 license. This mostly applies to files vendored from the Docker SDK for Python.

All files have a machine readable SDPX-License-Identifier: comment denoting its respective license(s) or an equivalent entry in an accompanying .license file. Only changelog fragments (which will not be part of a release) are covered by a blanket statement in .reuse/dep5. This conforms to the REUSE specification.