Difference between revisions of "Docker compose"

From wikieduonline
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 38: Line 38:
 
*<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 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 pause</code>
 
*<code>docker-compose pause</code>
*<code>docker-compose port</code>
+
* <code>[[docker-compose port]]</code>
 
*<code>docker-compose ps</code>
 
*<code>docker-compose ps</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 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>
Line 67: Line 67:
 
== Related ==
 
== Related ==
 
* <code>[[--env-file]]</code> https://docs.docker.com/compose/environment-variables/#using-the---env-file--option
 
* <code>[[--env-file]]</code> https://docs.docker.com/compose/environment-variables/#using-the---env-file--option
 +
* [[labels]]
  
 
== See also ==
 
== See also ==

Latest revision as of 09:27, 21 April 2024

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

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

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]

  • brew install docker-compose

Basic commands[edit]

  • docker-compose -h (for list of commands and options)
  • docker-compose up
  • docker-compose up -d
-d daemon
  • Start your containers with a command line variable: YOUR_VARIABLE=YOUR_VALUE docker-compose up[2]


  • docker-compose -p NAME --project-name

Logs:

  • docker-compose build
  • docker-compose bundle
  • docker-compose config
  • docker-compose create
  • docker-compose down
docker-compose down --remove-orphans
  • docker-compose events
  • docker-compose exec
  • docker-compose help
  • docker-compose images
  • docker-compose kill
  • docker-compose logs[4]: docker-compose logs SERVICE_NAME (You will find your SERVICE_NAME looking into your docker-compose.yml file)
  • docker-compose pause
  • docker-compose port
  • docker-compose ps
  • docker-compose pull[5].docker-compose pull SERVICE_NAME. Just pull container images but do not start them. To update your image and start your services: docker-compose pull && docker-compose up -d
  • docker-compose push
  • docker-compose restart
  • docker-compose rm
  • docker-compose run
  • docker-compose scale
  • docker-compose start
  • docker-compose stop
  • docker-compose top
  • docker-compose unpause
  • docker-compose up

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/release notes: 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[6] or templating added in 3.4 version. [7]

Related[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: