Parameter |
Choices/Defaults |
Comments |
api_version
|
Default:
auto
|
The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported by docker-py.
If the value is not specified in the task, the value of environment variable DOCKER_API_VERSION will be used instead. If the environment variable is not set, the default value will be used.
aliases: docker_api_version
|
build
bool |
|
Use with state present to always build images prior to starting the application.
Same as running docker-compose build with the pull option.
Images will only be rebuilt if Docker detects a change in the Dockerfile or build directory contents.
Use the nocache option to ignore the image cache when performing the build.
If an existing image is replaced, services using the image will be recreated unless recreate is never.
|
cacert_path
|
|
Use a CA certificate when performing server verification by providing the path to a CA certificate file.
If the value is not specified in the task and the environment variable DOCKER_CERT_PATH is set, the file ca.pem from the directory specified in the environment variable DOCKER_CERT_PATH will be used.
aliases: tls_ca_cert
|
cert_path
|
|
Path to the client's TLS certificate file.
If the value is not specified in the task and the environment variable DOCKER_CERT_PATH is set, the file cert.pem from the directory specified in the environment variable DOCKER_CERT_PATH will be used.
aliases: tls_client_cert
|
debug
bool |
|
Debug mode
|
definition
|
|
Provide docker-compose yaml describing one or more services, networks and volumes.
Mutually exclusive with project_src and files .
|
dependencies
bool |
|
When state is present specify whether or not to include linked services.
|
docker_host
|
Default:
unix://var/run/docker.sock
|
The URL or Unix socket path used to connect to the Docker API. To connect to a remote host, provide the TCP connection string. For example, 'tcp://192.0.2.23:2376'. If TLS is used to encrypt the connection, the module will automatically replace 'tcp' in the connection URL with 'https'.
If the value is not specified in the task, the value of environment variable DOCKER_HOST will be used instead. If the environment variable is not set, the default value will be used.
aliases: docker_url
|
files
|
|
List of file names relative to project_src . Overrides docker-compose.yml or docker-compose.yaml.
Files are loaded and merged in the order given.
|
hostname_check
bool |
|
Whether or not to check the Docker daemon's hostname against the name provided in the client certificate.
|
key_path
|
|
Path to the client's TLS key file.
If the value is not specified in the task and the environment variable DOCKER_CERT_PATH is set, the file key.pem from the directory specified in the environment variable DOCKER_CERT_PATH will be used.
aliases: tls_client_key
|
nocache
bool
(added in 2.2) |
|
Use with the build option to ignore the cache during the image build process.
|
project_name
|
|
Provide a project name. If not provided, the project name is taken from the basename of project_src .
Required when definition is provided.
|
project_src
|
|
Path to a directory containing a docker-compose.yml or docker-compose.yaml file.
Mutually exclusive with definition .
Required when no definition is provided.
|
pull
bool
(added in 2.2) |
|
Use with state present to always pull images prior to starting the application.
Same as running docker-compose pull.
When a new image is pulled, services using the image will be recreated unless recreate is never.
|
recreate
|
Choices:
- always
- never
smart ←
|
By default containers will be recreated when their configuration differs from the service definition.
Setting to never ignores configuration differences and leaves existing containers unchanged.
Setting to always forces recreation of all existing containers.
|
remove_images
|
|
Use with state absent to remove the all images or only local images.
|
remove_orphans
bool |
|
Remove containers for services not defined in the compose file.
|
remove_volumes
bool |
|
Use with state absent to remove data volumes.
|
restarted
bool |
|
Use with state present to restart all containers.
|
scale
|
|
When state is present scale services. Provide a dictionary of key/value pairs where the key is the name of the service and the value is an integer count for the number of containers.
|
services
|
|
When state is present run docker-compose up on a subset of services.
|
ssl_version
|
|
Provide a valid SSL version number. Default value determined by ssl.py module.
If the value is not specified in the task, the value of environment variable DOCKER_SSL_VERSION will be used instead.
|
state
|
Choices:
- absent
present ←
|
Desired state of the project.
Specifying present is the same as running docker-compose up.
Specifying absent is the same as running docker-compose down.
|
stopped
bool |
|
Use with state present to leave the containers in an exited or non-running state.
|
timeout
|
Default:
10
|
timeout in seconds for container shutdown when attached or when containers are already running.
|
tls
bool |
|
Secure the connection to the API by using TLS without verifying the authenticity of the Docker host server.
If the value is not specified in the task, the value of environment variable DOCKER_TLS will be used instead. If the environment variable is not set, the default value will be used.
|
tls_hostname
|
Default:
localhost
|
When verifying the authenticity of the Docker Host server, provide the expected name of the server.
If the value is not specified in the task, the value of environment variable DOCKER_TLS_HOSTNAME will be used instead. If the environment variable is not set, the default value will be used.
|
tls_verify
bool |
|
Secure the connection to the API by using TLS and verifying the authenticity of the Docker host server.
If the value is not specified in the task, the value of environment variable DOCKER_TLS_VERIFY will be used instead. If the environment variable is not set, the default value will be used.
|