Difference between revisions of "Docker-compose"
Jump to navigation
Jump to search
Tags: Mobile web edit, Mobile edit |
(→Logs) |
||
(19 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{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. | [[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. | ||
Line 9: | Line 10: | ||
== Installation == | == Installation == | ||
Available for [[macOS]], [[Linux]] and [[Windows]] | Available for [[macOS]], [[Linux]] and [[Windows]] | ||
− | * macOS: <code>[[brew]] install docker-compose</code> | + | * 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 --log-level</code> | * <code>docker-compose --log-level</code> | ||
Line 24: | Line 28: | ||
: <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>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 -p | + | * <code>[[docker-compose -p]] YOUR_PROJECT_NAME or [[docker-compose --project-name YOUR_PROJECT_NAME</code> |
− | Logs | + | * [[docker-compose --env-file]] |
+ | |||
+ | === Logs === | ||
* <code>[[docker-compose logs]]</code> View output from containers | * <code>[[docker-compose logs]]</code> View output from containers | ||
** <code>docker-compose logs -f</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 pull]] SERVICE_NAME</code> or <code>docker-compose pull</code> | ||
− | ** <code>docker-compose --verbose pull</code> | + | ** <code>[[docker-compose --verbose]] pull</code> |
*<code>[[docker-compose version]]</code> | *<code>[[docker-compose version]]</code> | ||
== All commands == | == 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> (deprecated) | * <code>[[docker-compose create]]</code> (deprecated) | ||
Line 43: | Line 49: | ||
::<code>docker-compose down --volumes</code> | ::<code>docker-compose down --volumes</code> | ||
* <code>[[docker-compose events]]</code> | * <code>[[docker-compose events]]</code> | ||
− | * <code>docker-compose exec</code> | + | * <code>[[docker-compose exec]]</code> |
* <code>docker-compose help</code> | * <code>docker-compose help</code> | ||
* <code>[[docker-compose images]]</code> | * <code>[[docker-compose images]]</code> | ||
Line 84: | Line 90: | ||
* <code>[[--force-recreate]]</code> | * <code>[[--force-recreate]]</code> | ||
* <code>[[/etc/docker/daemon.json]]</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 == | ||
* {{docker stack}} | * {{docker stack}} | ||
− | |||
* {{docker-compose}} | * {{docker-compose}} | ||
* {{docker}} | * {{docker}} | ||
− | |||
{{CC license}} | {{CC license}} |
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/
Contents
Installation[edit]
Available for macOS, Linux and Windows
- macOS:
brew install docker-compose
- Linux:
Basic commands[edit]
docker-compose -h
(for list of commands and options)
docker-compose --log-level
docker-compose up
[2] Builds, (re)creates, starts, and attaches to containers for a service.
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]
docker-compose logs
View output from containersdocker-compose logs -f
View output from containers
docker-compose pull SERVICE_NAME
ordocker-compose pull
docker-compose version
All commands[edit]
docker-compose
[4]
docker-compose build
docker-compose bundle
docker-compose config
docker-compose create
(deprecated)docker-compose down
docker-compose down --remove-orphans
docker-compose down --volumes
docker-compose events
docker-compose exec
docker-compose help
docker-compose images
docker-compose kill
docker-compose logs
[5]: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
[6].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
(Feb 2017) [7]docker-compose unpause
docker-compose up
docker-compose version
Operations:
Docker compose file: docker-compose.yml[edit]
Activities[edit]
Basic[edit]
- Read
docker-compose
StackOverflow questions: https://stackoverflow.com/questions/tagged/docker-compose?tab=Votes - Read
docker-compose
changelog: https://github.com/docker/compose/blob/master/CHANGELOG.md - Review docker compose file format evolution
Advanced[edit]
- Read
docker-compose
source code: https://github.com/docker/compose - Read Ansible module documentation about
docker_compose
: https://docs.ansible.com/ansible/latest/modules/docker_compose_module.html - Learn to use extension-fields[8] or templating added in 3.4 version. [9]
Related terms[edit]
--force-recreate
/etc/docker/daemon.json
volumes:
links:
environment:
- Nomad
- Docker-compose.yml examples: Mediawiki official docker-compose example
- Docker compose release notes
- Docker compose for amazon ECS
See also[edit]
docker stack
anddocker swarm
commandsdocker-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
- Docker:
docker-compose
, Docker Desktop, Docker Scout, Docker Swarm, Docker Volumes, Docker images management, docker network,docker inspect
,docker volume inspect
,Dockerfile
, Docker Engine release notes,docker kill
,moby
, Docker-in-Docker,docker context
,buildx
,docker tag
,docker system prune
, Docker Hub,hub-tool, /etc/docker/daemon.json
,hostconfig.json
, dockerd, logs, Docker logging, Backup,docker service
,depends on
,--dns, --filter
,--mount
,docker login
,docker build
,apt remove docker.io
,.dockerignore
, docker context ls |docker-machine, .docker/
, PWD,$HOME/.docker/config.json
, Docker ID,--env-file, docker --help
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
- ↑ https://docs.docker.com/compose/
- ↑ https://docs.docker.com/compose/reference/up/
- ↑ https://www.oreilly.com/ideas/3-docker-compose-features-for-improving-team-development-workflow
- ↑ https://docs.docker.com/compose/reference/
- ↑ https://docs.docker.com/compose/reference/logs/
- ↑ https://docs.docker.com/compose/reference/pull/
- ↑ https://github.com/docker/compose/blob/master/CHANGELOG.md#1110-2017-02-08
- ↑ https://docs.docker.com/compose/compose-file/#extension-fields
- ↑ https://www.oreilly.com/ideas/3-docker-compose-features-for-improving-team-development-workflow
Advertising: