Difference between revisions of "Docker compose file: docker-compose.yml"

From wikieduonline
Jump to navigation Jump to search
Tags: Mobile web edit, Mobile edit
Tags: Mobile web edit, Mobile edit
Line 4: Line 4:
 
<ref>https://docs.docker.com/compose/compose-file/</ref>
 
<ref>https://docs.docker.com/compose/compose-file/</ref>
  
== Examples ==
+
== [[docker-compose.yml examples]] ==
* [[Docker-compose.yml (Grafana)]] creating 1 [[Grafana]] service
 
* [[ElasticSearch docker-compose example]]: https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-compose-file
 
 
 
  
 
== YAML Explained ==
 
== YAML Explained ==

Revision as of 12:03, 27 January 2020

Review different versions of docker-compose.yml

[1]

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 definitions
  • rollback_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 definitions
  • name for networks, secrets and configs
  • shm_size in build configurations


v3.1 (2017-02-08)[3]

Restart policy

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


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: