mirror of https://github.com/docker/compose.git
190 lines
7.7 KiB
YAML
190 lines
7.7 KiB
YAML
command: docker compose
|
||
short: Docker Compose
|
||
long: "You can use compose subcommand, `docker compose [-f <arg>...] [options] [COMMAND]
|
||
[ARGS...]`, to build and manage\nmultiple services in Docker containers.\n\n###
|
||
Use `-f` to specify name and path of one or more Compose files\nUse the `-f` flag
|
||
to specify the location of a Compose configuration file.\n\n#### Specifying multiple
|
||
Compose files\nYou can supply multiple `-f` configuration files. When you supply
|
||
multiple files, Compose combines them into a single \nconfiguration. Compose builds
|
||
the configuration in the order you supply the files. Subsequent files override
|
||
and add \nto their predecessors.\n\nFor example, consider this command line:\n\n```\n$
|
||
docker-compose -f docker-compose.yml -f docker-compose.admin.yml run backup_db\n```\nThe
|
||
`docker-compose.yml` file might specify a `webapp` service.\n\n```yaml\nservices:\n
|
||
\ webapp:\n image: examples/web\n ports:\n - \"8000:8000\"\n volumes:\n
|
||
\ - \"/data\"\n```\nIf the `docker-compose.admin.yml` also specifies this
|
||
same service, any matching fields override the previous file. \nNew values, add
|
||
to the `webapp` service configuration.\n\n```yaml\nservices:\n webapp:\n build:
|
||
.\n environment:\n - DEBUG=1\n```\n\nWhen you use multiple Compose files,
|
||
all paths in the files are relative to the first configuration file specified
|
||
\nwith `-f`. You can use the `--project-directory` option to override this base
|
||
path.\n\nUse a `-f` with `-` (dash) as the filename to read the configuration
|
||
from stdin. When stdin is used all paths in the \nconfiguration are relative to
|
||
the current working directory.\n\nThe `-f` flag is optional. If you don’t provide
|
||
this flag on the command line, Compose traverses the working directory \nand its
|
||
parent directories looking for a `compose.yaml` or `docker-compose.yaml` file.\n\n####
|
||
Specifying a path to a single Compose file\nYou can use the `-f` flag to specify
|
||
a path to a Compose file that is not located in the current directory, either
|
||
\nfrom the command line or by setting up a `COMPOSE_FILE` environment variable
|
||
in your shell or in an environment file.\n\nFor an example of using the `-f` option
|
||
at the command line, suppose you are running the Compose Rails sample, and \nhave
|
||
a `compose.yaml` file in a directory called `sandbox/rails`. You can use a command
|
||
like `docker compose pull` to \nget the postgres image for the db service from
|
||
anywhere by using the `-f` flag as follows: \n```\ndocker compose -f ~/sandbox/rails/compose.yaml
|
||
pull db\n```\n\n### Use `-p` to specify a project name\n\nEach configuration has
|
||
a project name. If you supply a `-p` flag, you can specify a project name. If
|
||
you don’t \nspecify the flag, Compose uses the current directory name. \nProject
|
||
name can also be set by `COMPOSE_PROJECT_NAME` environment variable.\n\nMost compose
|
||
subcommand can be ran without a compose file, just passing \nproject name to retrieve
|
||
the relevant resources.\n\n```\n$ docker compose -p my_project ps -a\nNAME SERVICE
|
||
\ STATUS PORTS\nmy_project_demo_1 demo running \n\n$
|
||
docker compose -p my_project logs\ndemo_1 | PING localhost (127.0.0.1): 56 data
|
||
bytes\ndemo_1 | 64 bytes from 127.0.0.1: seq=0 ttl=64 time=0.095 ms\n```\n\n###
|
||
Use profiles to enable optional services\n\nUse `--profile` to specify one or
|
||
more active profiles\nCalling `docker compose --profile frontend up` will start
|
||
the services with the profile `frontend` and services \nwithout any specified
|
||
profiles. \nYou can also enable multiple profiles, e.g. with `docker compose --profile
|
||
frontend --profile debug up` the profiles `frontend` and `debug` will be enabled.\n\nProfiles
|
||
can also be set by `COMPOSE_PROFILES` environment variable.\n\n### Set up environment
|
||
variables\n\nYou can set environment variables for various docker-compose options,
|
||
including the `-f`, `-p` and `--profiles` flags.\n\nSetting the `COMPOSE_FILE`
|
||
environment variable is equivalent to passing the `-f` flag,\n`COMPOSE_PROJECT_NAME`
|
||
environment variable does the same for to the `-p` flag,\nand so does `COMPOSE_PROFILES`
|
||
environment variable for to the `--profiles` flag.\n\nIf flags are explicitly
|
||
set on command line, associated environment variable is ignored"
|
||
usage: docker compose
|
||
pname: docker
|
||
plink: docker.yaml
|
||
cname:
|
||
- docker compose build
|
||
- docker compose convert
|
||
- docker compose cp
|
||
- docker compose create
|
||
- docker compose down
|
||
- docker compose events
|
||
- docker compose exec
|
||
- docker compose images
|
||
- docker compose kill
|
||
- docker compose logs
|
||
- docker compose ls
|
||
- docker compose pause
|
||
- docker compose port
|
||
- docker compose ps
|
||
- docker compose pull
|
||
- docker compose push
|
||
- docker compose restart
|
||
- docker compose rm
|
||
- docker compose run
|
||
- docker compose start
|
||
- docker compose stop
|
||
- docker compose top
|
||
- docker compose unpause
|
||
- docker compose up
|
||
clink:
|
||
- docker_compose_build.yaml
|
||
- docker_compose_convert.yaml
|
||
- docker_compose_cp.yaml
|
||
- docker_compose_create.yaml
|
||
- docker_compose_down.yaml
|
||
- docker_compose_events.yaml
|
||
- docker_compose_exec.yaml
|
||
- docker_compose_images.yaml
|
||
- docker_compose_kill.yaml
|
||
- docker_compose_logs.yaml
|
||
- docker_compose_ls.yaml
|
||
- docker_compose_pause.yaml
|
||
- docker_compose_port.yaml
|
||
- docker_compose_ps.yaml
|
||
- docker_compose_pull.yaml
|
||
- docker_compose_push.yaml
|
||
- docker_compose_restart.yaml
|
||
- docker_compose_rm.yaml
|
||
- docker_compose_run.yaml
|
||
- docker_compose_start.yaml
|
||
- docker_compose_stop.yaml
|
||
- docker_compose_top.yaml
|
||
- docker_compose_unpause.yaml
|
||
- docker_compose_up.yaml
|
||
options:
|
||
- option: ansi
|
||
value_type: string
|
||
default_value: auto
|
||
description: |
|
||
Control when to print ANSI control characters ("never"|"always"|"auto")
|
||
deprecated: false
|
||
experimental: false
|
||
experimentalcli: false
|
||
kubernetes: false
|
||
swarm: false
|
||
- option: env-file
|
||
value_type: string
|
||
description: Specify an alternate environment file.
|
||
deprecated: false
|
||
experimental: false
|
||
experimentalcli: false
|
||
kubernetes: false
|
||
swarm: false
|
||
- option: file
|
||
shorthand: f
|
||
value_type: stringArray
|
||
default_value: '[]'
|
||
description: Compose configuration files
|
||
deprecated: false
|
||
experimental: false
|
||
experimentalcli: false
|
||
kubernetes: false
|
||
swarm: false
|
||
- option: no-ansi
|
||
value_type: bool
|
||
default_value: "false"
|
||
description: Do not print ANSI control characters (DEPRECATED)
|
||
deprecated: false
|
||
experimental: false
|
||
experimentalcli: false
|
||
kubernetes: false
|
||
swarm: false
|
||
- option: profile
|
||
value_type: stringArray
|
||
default_value: '[]'
|
||
description: Specify a profile to enable
|
||
deprecated: false
|
||
experimental: false
|
||
experimentalcli: false
|
||
kubernetes: false
|
||
swarm: false
|
||
- option: project-directory
|
||
value_type: string
|
||
description: |-
|
||
Specify an alternate working directory
|
||
(default: the path of the Compose file)
|
||
deprecated: false
|
||
experimental: false
|
||
experimentalcli: false
|
||
kubernetes: false
|
||
swarm: false
|
||
- option: project-name
|
||
shorthand: p
|
||
value_type: string
|
||
description: Project name
|
||
deprecated: false
|
||
experimental: false
|
||
experimentalcli: false
|
||
kubernetes: false
|
||
swarm: false
|
||
- option: workdir
|
||
value_type: string
|
||
description: |-
|
||
DEPRECATED! USE --project-directory INSTEAD.
|
||
Specify an alternate working directory
|
||
(default: the path of the Compose file)
|
||
deprecated: false
|
||
experimental: false
|
||
experimentalcli: false
|
||
kubernetes: false
|
||
swarm: false
|
||
deprecated: false
|
||
experimental: false
|
||
experimentalcli: false
|
||
kubernetes: false
|
||
swarm: false
|
||
|