Difference between revisions of "Docker-compose"

From wikieduonline
Jump to navigation Jump to search
 
(76 intermediate revisions by 4 users not shown)
Line 1: Line 1:
[[wikipedia:Docker_(software)#Tools|Docker Compose]]<ref>https://docs.docker.com/compose/</ref> is a tool available since 2014 for defining and running multi-container Docker applications.
+
{{lowercase}}
 +
[[wikipedia:Docker_(software)#Tools|Docker Compose]]<ref>https://docs.docker.com/compose/</ref> is a tool available since October 2014 for defining and running multi-[[container]] [[Docker]] applications.
  
Rules are defined in <code>[[DevOps/Docker/docker compose/Docker compose file: docker-compose.yml|docker-compose.yml]]</code> and executed by running <code>docker-compose up</code>.
+
Rules are defined in <code>[[docker-compose.yml]]</code> and executed by running <code>[[docker-compose up]]</code> command.
  
<code>docker-compose</code> allows to define start order dependencies between containers.
+
<code>docker-compose</code> allows to define start order [[dependencies]] between [[containers]].
  
 
For reference of valid options for docker compose check: https://docs.docker.com/compose/compose-file/
 
For reference of valid options for docker compose check: https://docs.docker.com/compose/compose-file/
  
 
== Installation ==
 
== Installation ==
* <code>[[macOS/Homebrew|brew]] install docker-compose</code>
+
Available for [[macOS]], [[Linux]] and [[Windows]]
 +
* macOS: <code>[[brew install]] docker-compose</code>
 +
* Linux:
 +
** <code>[[pip install docker-compose]]</code>
 +
** <code>[[apt install docker-compose]]</code>
  
 
== Basic commands ==
 
== Basic commands ==
* <code>docker-compose -h</code> (for list of commands and options)
+
* <code>[[docker-compose -h]]</code> (for list of commands and options)
* <code>docker-compose up</code><ref>https://docs.docker.com/compose/reference/up/</ref> Builds, (re)creates, starts, and attaches to containers for a service.
 
* <code>docker-compose up -d</code>
 
:-d daemon
 
* Start your containers with a command line variable: <code>YOUR_VARIABLE=YOUR_VALUE docker-compose up</code><ref>https://www.oreilly.com/ideas/3-docker-compose-features-for-improving-team-development-workflow</ref>
 
  
 +
* <code>docker-compose --log-level</code>
  
* <code>docker-compose -p NAME --project-name</code>
+
* <code>[[docker-compose up]]</code><ref>https://docs.docker.com/compose/reference/up/</ref> Builds, (re)creates, starts, and attaches to containers for a service.
 +
:: <code>[[docker-compose up]] SERVICE_NAME</code>
 +
:: <code>[[docker-compose up]] -d</code>
 +
:::<code>-d daemon</code>
 +
::<code>docker-compose -f docker-compose_YOUR_NAME.yml up -d</code>
 +
* Start your containers with a command line variable:
 +
: <code>YOUR_VARIABLE=YOUR_VALUE docker-compose up</code><ref>https://www.oreilly.com/ideas/3-docker-compose-features-for-improving-team-development-workflow</ref>
  
Logs:
+
* <code>[[docker-compose -p]] YOUR_PROJECT_NAME or [[docker-compose --project-name YOUR_PROJECT_NAME</code>
* <code>docker-compose logs</code> View output from containers
 
* <code>docker-compose logs -f</code> View output from containers
 
* <code>docker-compose pull SERVICE_NAME</code> or <code>docker-compose pull</code>
 
** <code>docker-compose --verbose pull</code>
 
  
 +
* [[docker-compose --env-file]]
 +
 +
=== Logs ===
 +
* <code>[[docker-compose logs]]</code> View output from containers
 +
** <code>docker-compose logs -f</code> View output from containers
 +
* <code>[[docker-compose pull]] SERVICE_NAME</code> or <code>docker-compose pull</code>
 +
** <code>[[docker-compose --verbose]] pull</code>
 +
*<code>[[docker-compose version]]</code>
 +
 +
== All commands ==
 
<code>docker-compose</code><ref>https://docs.docker.com/compose/reference/</ref>
 
<code>docker-compose</code><ref>https://docs.docker.com/compose/reference/</ref>
*<code>docker-compose build</code>
+
* <code>[[docker-compose build]]</code>
*<code>docker-compose bundle</code>
+
* <code>[[docker-compose bundle]]</code>
*<code>docker-compose config</code>
+
* <code>[[docker-compose config]]</code>
*<code>docker-compose create</code>
+
* <code>[[docker-compose create]]</code> (deprecated)
*<code>docker-compose down</code>
+
* <code>[[docker-compose down]]</code>
:<code>docker-compose down --remove-orphans</code>
+
::<code>[[docker-compose down --remove-orphans]]</code>
*<code>docker-compose events</code>
+
::<code>docker-compose down --volumes</code>
*<code>docker-compose exec</code>
+
* <code>[[docker-compose events]]</code>
*<code>docker-compose help</code>
+
* <code>[[docker-compose exec]]</code>
*<code>docker-compose images</code>
+
* <code>docker-compose help</code>
*<code>docker-compose kill</code>
+
* <code>[[docker-compose images]]</code>
*<code>docker-compose logs</code><ref>https://docs.docker.com/compose/reference/logs/</ref>: <code>docker-compose logs SERVICE_NAME</code> (You will find your SERVICE_NAME looking into your docker-compose.yml file)
+
* <code>docker-compose kill</code>
*<code>docker-compose pause</code>
+
* <code>[[docker-compose logs]]</code><ref>https://docs.docker.com/compose/reference/logs/</ref>: <code>docker-compose logs SERVICE_NAME</code> (You will find your SERVICE_NAME looking into your docker-compose.yml file)
*<code>docker-compose port</code>
+
* <code>docker-compose pause</code>
*<code>docker-compose ps</code>
+
* <code>docker-compose port</code>
*<code>docker-compose pull</code><ref>https://docs.docker.com/compose/reference/pull/</ref>.<code>docker-compose pull SERVICE_NAME</code>. Just pull container images but do not start them. To update your image and start your services: <code>docker-compose pull && docker-compose up -d</code>
+
* <code>[[docker-compose ps]]</code>
*<code>docker-compose push</code>
+
* <code>docker-compose pull</code><ref>https://docs.docker.com/compose/reference/pull/</ref>.<code>docker-compose pull SERVICE_NAME</code>. Just pull container images but do not start them. To update your image and start your services: <code>docker-compose pull && docker-compose up -d</code>
*<code>docker-compose restart</code>
+
*<code> [[docker-compose push]] </code>
 +
*<code>[[docker-compose restart]]</code>
 
*<code>docker-compose rm</code>
 
*<code>docker-compose rm</code>
*<code>docker-compose run</code>
+
*<code>[[docker-compose run]]</code>
 
*<code>docker-compose scale</code>
 
*<code>docker-compose scale</code>
 
*<code>[[docker-compose start]]</code>
 
*<code>[[docker-compose start]]</code>
*<code>docker-compose stop</code>  
+
*<code>[[docker-compose stop]]</code>  
 
*<code>[[docker-compose top]]</code> (Feb 2017) <ref>https://github.com/docker/compose/blob/master/CHANGELOG.md#1110-2017-02-08</ref>
 
*<code>[[docker-compose top]]</code> (Feb 2017) <ref>https://github.com/docker/compose/blob/master/CHANGELOG.md#1110-2017-02-08</ref>
 
*<code>docker-compose unpause</code>
 
*<code>docker-compose unpause</code>
*<code>docker-compose up</code>
+
*<code>[[docker-compose up]]</code>
 +
*<code>[[docker-compose version]]</code>
 +
 
 +
Operations:
 +
* {{Docker-compose operations}}
  
 
== [[Docker compose file: docker-compose.yml]] ==
 
== [[Docker compose file: docker-compose.yml]] ==
Line 60: Line 79:
 
# Read <code>docker-compose</code> StackOverflow questions: https://stackoverflow.com/questions/tagged/docker-compose?tab=Votes
 
# Read <code>docker-compose</code> StackOverflow questions: https://stackoverflow.com/questions/tagged/docker-compose?tab=Votes
 
# Read  <code>docker-compose</code> [[Docker compose changelog|changelog]]: https://github.com/docker/compose/blob/master/CHANGELOG.md
 
# Read  <code>docker-compose</code> [[Docker compose changelog|changelog]]: https://github.com/docker/compose/blob/master/CHANGELOG.md
# [[/Review docker compose file format evolution/]]
+
# [[Review docker compose file format evolution]]
  
 
=== Advanced ===
 
=== Advanced ===
 
# Read <code>docker-compose</code> source code: https://github.com/docker/compose
 
# Read <code>docker-compose</code> source code: https://github.com/docker/compose
# Read [[DevOps/Ansible/Modules|Ansible module]] documentation about <code>docker_compose</code>: https://docs.ansible.com/ansible/latest/modules/docker_compose_module.html
+
# Read [[Ansible module]] documentation about <code>docker_compose</code>: https://docs.ansible.com/ansible/latest/modules/docker_compose_module.html
 
# Learn to use extension-fields<ref>https://docs.docker.com/compose/compose-file/#extension-fields </ref> or templating added in 3.4 version. <ref>https://www.oreilly.com/ideas/3-docker-compose-features-for-improving-team-development-workflow</ref>
 
# Learn to use extension-fields<ref>https://docs.docker.com/compose/compose-file/#extension-fields </ref> or templating added in 3.4 version. <ref>https://www.oreilly.com/ideas/3-docker-compose-features-for-improving-team-development-workflow</ref>
 +
 +
 +
== Related terms ==
 +
* <code>[[--force-recreate]]</code>
 +
* <code>[[/etc/docker/daemon.json]]</code>
 +
* <code>[[volumes:]]</code>
 +
* <code>[[links:]]</code>
 +
* <code>[[environment:]]</code>
 +
* [[Nomad]]
 +
* [[Docker-compose.yml examples]]: [[Mediawiki official docker-compose example]]
 +
* [[Docker compose release notes]]
 +
* [[Docker compose for amazon ECS]]
  
 
== See also ==
 
== See also ==
* <code>[[docker stack]]</code> and <code>[[docker swarm]]</code> commands
+
* {{docker stack}}
* <code>[[docker start]]</code>
 
* {{kubernetes}}
 
 
* {{docker-compose}}
 
* {{docker-compose}}
 
+
* {{docker}}
  
 
{{CC license}}
 
{{CC license}}
Line 80: Line 109:
 
[[Category:Software development]]
 
[[Category:Software development]]
 
[[Category:Server administration]]
 
[[Category:Server administration]]
 +
[[Category:Docker]]

Latest revision as of 12:28, 25 October 2024

Docker Compose[1] is a tool available since October 2014 for defining and running multi-container Docker applications.

Rules are defined in docker-compose.yml and executed by running docker-compose up command.

docker-compose allows to define start order dependencies between containers.

For reference of valid options for docker compose check: https://docs.docker.com/compose/compose-file/

Installation[edit]

Available for macOS, Linux and Windows

Basic commands[edit]

  • docker-compose --log-level
docker-compose up SERVICE_NAME
docker-compose up -d
-d daemon
docker-compose -f docker-compose_YOUR_NAME.yml up -d
  • Start your containers with a command line variable:
YOUR_VARIABLE=YOUR_VALUE docker-compose up[3]
  • docker-compose -p YOUR_PROJECT_NAME or [[docker-compose --project-name YOUR_PROJECT_NAME

Logs[edit]

All commands[edit]

docker-compose[4]

docker-compose down --remove-orphans
docker-compose down --volumes

Operations:

Docker compose file: docker-compose.yml[edit]

Activities[edit]

Basic[edit]

  1. Read docker-compose StackOverflow questions: https://stackoverflow.com/questions/tagged/docker-compose?tab=Votes
  2. Read docker-compose changelog: https://github.com/docker/compose/blob/master/CHANGELOG.md
  3. Review docker compose file format evolution

Advanced[edit]

  1. Read docker-compose source code: https://github.com/docker/compose
  2. Read Ansible module documentation about docker_compose: https://docs.ansible.com/ansible/latest/modules/docker_compose_module.html
  3. Learn to use extension-fields[8] or templating added in 3.4 version. [9]


Related terms[edit]

See also[edit]

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.

Source: https://en.wikiversity.org/wiki/DevOps/Docker/docker_compose

Advertising: