docker_network
Create and remove Docker networks and their options
Collection: community.docker
Full Name: parallax.community.general.docker_network
Aliases: community.general.docker_network, docker_network, community.docker.docker_network
Synopsis
Create and remove Docker networks and their options
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| name | string | yes | Name of the Docker network | |
| state | string | present | State of the network Choices: present, absent | |
| driver | string | bridge | Network driver to use | |
| driver_options | raw | Dictionary of driver options; legacy comma-separated key=value pairs are also accepted | ||
| ipam_driver | string | IPAM driver to use | ||
| ipam_config | raw | List of IPAM configuration dictionaries; legacy subnet=x,gateway=y is also accepted | ||
| ipam_options | raw | Dictionary of IPAM driver options | ||
| enable_ipv6 | bool | Enable IPv6 networking | ||
| internal | bool | Restrict external access to the network | ||
| force | bool | false | Force recreation of an existing network | |
| labels | raw | Dictionary of labels; legacy comma-separated key=value pairs are also accepted | ||
| scope | string | Network scope (local, global, swarm) | ||
| attachable | bool | Enable manual container attachment | ||
| connected | list | Containers to attach to the network | ||
| appends | bool | false | Keep existing connected containers | |
| docker_host | string | Docker socket or TCP URL; defaults to DOCKER_HOST or unix:///var/run/docker.sock | ||
| api_version | string | Docker API version; defaults to DOCKER_API_VERSION or auto | ||
| timeout | int | Request timeout in seconds; defaults to DOCKER_TIMEOUT or 60 | ||
| tls | bool | Enable TLS without server verification; defaults to DOCKER_TLS | ||
| validate_certs | bool | Verify TLS certificates; defaults to DOCKER_TLS_VERIFY | ||
| tls_hostname | string | Expected TLS server name; defaults to DOCKER_TLS_HOSTNAME | ||
| ca_path | string | CA certificate file | ||
| client_cert | string | TLS client certificate | ||
| client_key | string | TLS client private key | ||
| use_ssh_client | bool | false | Select OpenSSH for SSH Docker transports | |
| debug | bool | false | Enable diagnostic mode |
Example
yaml
- name: Create the backend network
docker_network:
name: backend
driver: bridge
internal: true
state: present