Difference between revisions of "Docker compose file: docker-compose.yml"
Jump to navigation
Jump to search
(2 intermediate revisions by the same user not shown) | |||
Line 95: | Line 95: | ||
* <code>[[labels:]]</code> | * <code>[[labels:]]</code> | ||
* <code>[[build:]]</code> | * <code>[[build:]]</code> | ||
− | * [[image:]] | + | * [[docker-compose.yml: image:]] |
+ | * <code>[[yq]] '.services[].container_name' docker-compose.yml</code> | ||
== See also == | == See also == |
Latest revision as of 14:52, 25 August 2024
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[edit]
YAML Explained[edit]
Version and at least one service is needed.
services: ... volumes: [2] ... config: [3] ... secrets:[4] ... networks: [5] ...
version: "3.9" Informative/deprecated https://docs.docker.com/compose/compose-file/#version-top-level-element
Version 3[edit]
https://docs.docker.com/compose/compose-file/compose-versioning/#versioning
Removed options: volume_driver, volumes_from, cpu_shares, cpu_quota, cpuset, mem_limit, memswap_limit, extends, group_add
v3.8
max_replicas_per_node
in placement configurations
v3.7 (18.06.0+) (2018-07-17)[6]
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.2
CACHE_FROM
added
v3.1 (2017-02-08)[7]
- Introduces support for secrets
docker-compose top
Restart policy[edit]
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[edit]
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
Related terms[edit]
depends_on
container_name
https://docs.docker.com/compose/compose-file/#container_namemem_limit
domainname, hostname, ipc, mac_address, privileged, read_only, shm_size, stdin_open, tty, user, working_dir
[8]docker-compose up
expose:, ports:
labels:
build:
- docker-compose.yml: image:
yq '.services[].container_name' docker-compose.yml
See also[edit]
Dockerfile
- Version 3 resouces
docker-compose.yml: services:, volumes:, configs:, secrets:, networks:, driver:, depends_on:, extends:
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
- ↑ https://docs.docker.com/compose/compose-file/
- ↑ https://docs.docker.com/compose/compose-file/#volumes
- ↑ https://docs.docker.com/compose/compose-file/#configs
- ↑ https://docs.docker.com/compose/compose-file/#secrets
- ↑ https://docs.docker.com/compose/compose-file/#network-configuration-reference
- ↑ https://github.com/docker/compose/blob/master/CHANGELOG.md#1220-2018-07-17
- ↑ https://github.com/docker/compose/blob/master/CHANGELOG.md#1110-2017-02-08
- ↑ https://docs.docker.com/compose/compose-file/compose-file-v3/#domainname-hostname-ipc-mac_address-privileged-read_only-shm_size-stdin_open-tty-user-working_dir
Advertising: