Containers
Arguments
Argument | Default | Description |
---|---|---|
image | [Required] | Docker image to run |
service | The name of the service (e.g systemd unit name or deployment name) | |
env | A map of environment variables to pass through | |
labels | A map of labels to add to the container | |
docker_args | Additional arguments to the docker client e.g. -p 8080:8080 (![]() |
|
docker_opts | Additional options to the docker client e.g. -H unix:///tmp/var/run/docker.sock (![]() |
|
args | Additional arguments to the container | |
volumes | List of volume mappings | |
ports | List of port mappings | |
commands | List of commands to execute inside the container on startup (![]() |
|
files | Map of files to mount into the container (![]() |
|
templates | Map of templates to mount into the container (![]() |
|
network | user-bridge | ![]() |
cpu | CPU limit in cores (Defaults to 1 on ![]() |
|
mem | Memory Limit in MB. (Defaults to 1024 on ![]() |
|
replicas | 1 | Number of instances or containers to run |
containers_force_sha | false | When specified the SHA digest for each container will be looked up at deploy time and inserted into the image url. |
play.yml
- hosts: localhost roles: - deploy vars: containers: - image: nginx service: nginx env: DOMAIN: localhost.com - image: nginx service: nginx2 ports: - 8080:80
Docker Compose
Docker compose can also be used as a source to deploy to any target. Only the attributes listed below are supported:
- ports
- environment
- image
- deploy/resources/limits
- deploy/replicas
- deploy/endpoint_mode (use
dnsrr
for a NodePort in k8s) - networks (
only)
- ui.labels (See Load Balancing)
group_vars/group.yml
docker_compose_v3: - files/docker-compose.yml
files/docker-compose.yml
version: "3" services: gateway: image: gateway:4.1.0-SNAPSHOT deploy: resources: limits: memory: 2G environment: - TZ=Africa/Harare ports: - "8166:8166" networks: - user networks: user: external: name: public
Implemented as systemd services that controls container
Implemented as 1 ECS container per task per service using Weave overlay
Converted into a K8s Deployment and Service