Difference between revisions of "Docker compose file: docker-compose.yml"
Jump to navigation
Jump to search
Line 45: | Line 45: | ||
== Restart policy == | == Restart policy == | ||
* Version 3: <code>https://docs.docker.com/compose/compose-file/#restart_policy</code> | * Version 3: <code>https://docs.docker.com/compose/compose-file/#restart_policy</code> | ||
+ | :restart: "no" (default) | ||
+ | :restart: always | ||
+ | :restart: on-failure | ||
+ | :restart: unless-stopped | ||
+ | |||
<pre> | <pre> | ||
restart_policy: | restart_policy: | ||
Line 54: | Line 59: | ||
* Version 2: | * Version 2: | ||
<pre>- restart: no|always|on-failure</code><ref>https://docs.docker.com/compose/compose-file/compose-file-v2/</ref></pre> | <pre>- restart: no|always|on-failure</code><ref>https://docs.docker.com/compose/compose-file/compose-file-v2/</ref></pre> | ||
− | |||
== logging == | == logging == |
Revision as of 06:51, 3 February 2020
Review different versions of docker-compose.yml
- https://docs.docker.com/compose/compose-file/
- Options: https://docs.docker.com/compose/compose-file/compose-versioning/#versioning
Contents
docker-compose.yml examples
YAML Explained
Version and at least one service is needed.
version: "3.7" services: ... volumes: ... networks: ...
Version 3
Removed options: volume_driver, volumes_from, cpu_shares, cpu_quota, cpuset, mem_limit, memswap_limit, extends, group_add
v3.7 (18.06.0+) (2018-07-17)[2]
init
in service definitionsrollback_config
in deploy configurations- Support for extension fields at the root of service, network, volume, secret and config definitions
v3.6 (8.02.0+)
- tmpfs size for tmpfs-type mounts
v3.5
isolation
in service definitionsname
for networks, secrets and configsshm_size
in build configurations
v3.1 (2017-02-08)[3]
- Introduces support for secrets
docker-compose top
Restart policy
- restart: "no" (default)
- restart: always
- restart: on-failure
- restart: unless-stopped
restart_policy: condition: on-failure delay: 5s max_attempts: 3 window: 120s
- Version 2:
- restart: no|always|on-failure</code><ref>https://docs.docker.com/compose/compose-file/compose-file-v2/</ref>
logging
driver: none|local|json-file|syslog|journald|gelf|fluentd|awslogs|splunk|etwlogs|gcplogs|logentries
- json-file is the default option
See also: docker logs: docker logs --since 1h CONTAINER_NAME
See also
- DevOps/Docker/docker compose/Version 3 resouces
docker-compose
,docker-compose.yml
: [services
|volumes
|networks
|up
|down
|restart
|logs
|create
|changelog
|version
|secrets
|config
|-v
|-h
|exec], docker-compose pull
,Environment:
, Docker-compose.yml examples,.env
, release notes, expose:, docker-compose --env-file,services.deploy.resources
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.
Original Source: https://en.wikiversity.org/wiki/DevOps/Docker/docker_compose/Docker_compose_file:_docker-compose.yml
Advertising: