diff --git a/_data/toc.yaml b/_data/toc.yaml index d441bedb64..ae02866416 100644 --- a/_data/toc.yaml +++ b/_data/toc.yaml @@ -911,57 +911,57 @@ reference: - sectiontitle: Docker Compose CLI reference section: - path: /compose/reference/ - title: Overview of docker-compose CLI + title: Overview of docker compose CLI - path: /compose/reference/envvars/ title: CLI environment variables - path: /compose/reference/build/ - title: docker-compose build + title: docker compose build - path: /compose/reference/config/ - title: docker-compose config + title: docker compose config - path: /compose/reference/create/ - title: docker-compose create + title: docker compose create - path: /compose/reference/down/ - title: docker-compose down + title: docker compose down - path: /compose/reference/events/ - title: docker-compose events + title: docker compose events - path: /compose/reference/exec/ - title: docker-compose exec + title: docker compose exec - path: /compose/reference/help/ - title: docker-compose help + title: docker compose help - path: /compose/reference/images/ - title: docker-compose images + title: docker compose images - path: /compose/reference/kill/ - title: docker-compose kill + title: docker compose kill - path: /compose/reference/logs/ - title: docker-compose logs + title: docker compose logs - path: /compose/reference/pause/ - title: docker-compose pause + title: docker compose pause - path: /compose/reference/port/ - title: docker-compose port + title: docker compose port - path: /compose/reference/ps/ - title: docker-compose ps + title: docker compose ps - path: /compose/reference/pull/ - title: docker-compose pull + title: docker compose pull - path: /compose/reference/push/ - title: docker-compose push + title: docker compose push - path: /compose/reference/restart/ - title: docker-compose restart + title: docker compose restart - path: /compose/reference/rm/ - title: docker-compose rm + title: docker compose rm - path: /compose/reference/run/ - title: docker-compose run + title: docker compose run - path: /compose/reference/scale/ - title: docker-compose scale + title: docker compose scale - path: /compose/reference/start/ - title: docker-compose start + title: docker compose start - path: /compose/reference/stop/ - title: docker-compose stop + title: docker compose stop - path: /compose/reference/top/ - title: docker-compose top + title: docker compose top - path: /compose/reference/unpause/ - title: docker-compose unpause + title: docker compose unpause - path: /compose/reference/up/ - title: docker-compose up + title: docker compose up - title: Daemon CLI (dockerd) path: /engine/reference/commandline/dockerd/ - sectiontitle: API reference diff --git a/buildx/working-with-buildx.md b/buildx/working-with-buildx.md index 51411faea6..0981db821b 100644 --- a/buildx/working-with-buildx.md +++ b/buildx/working-with-buildx.md @@ -238,7 +238,7 @@ or combine BuildKit’s output for the user. For this use case, we have added a command called [`docker buildx bake`](../engine/reference/commandline/buildx_bake.md). The `bake` command supports building images from compose files, similar to -[`docker-compose build`](../compose/reference/build.md), but allowing all the +[`docker-compose build`](../engine/reference/commandline/compose_build.md), but allowing all the services to be built concurrently as part of a single request. There is also support for custom build rules from HCL/JSON files allowing diff --git a/compose/compose-file/compose-file-v2.md b/compose/compose-file/compose-file-v2.md index daf1c2de66..d3b97f5a9a 100644 --- a/compose/compose-file/compose-file-v2.md +++ b/compose/compose-file/compose-file-v2.md @@ -1292,7 +1292,7 @@ web: Specify the default number of containers to deploy for this service. Whenever you run `docker-compose up`, Compose creates or removes containers to match the specified number. This value can be overridden using the -[`--scale`](../reference/up.md) flag. +[`--scale`](../../engine/reference/commandline/compose_up.md) ```yaml web: diff --git a/compose/compose-file/compose-file-v3.md b/compose/compose-file/compose-file-v3.md index 6813d8a86f..4736616586 100644 --- a/compose/compose-file/compose-file-v3.md +++ b/compose/compose-file/compose-file-v3.md @@ -2315,7 +2315,7 @@ volumes: > > External volumes that do not exist _are created_ if you use [docker stack deploy](#deploy) > to launch the app in [swarm mode](../../engine/swarm/index.md) (instead of -> [docker compose up](../reference/up.md)). In swarm mode, a volume is +> [docker compose up](../../engine/reference/commandline/compose_up.md)). In swarm mode, a volume is > automatically created when it is defined by a service. As service tasks are > scheduled on new nodes, [swarmkit](https://github.com/docker/swarmkit/blob/master/README.md) > creates the volume on the local node. To learn more, see [moby/moby#29976](https://github.com/moby/moby/issues/29976). diff --git a/compose/environment-variables.md b/compose/environment-variables.md index 698c127bc6..07e0df5bd3 100644 --- a/compose/environment-variables.md +++ b/compose/environment-variables.md @@ -54,13 +54,12 @@ services: image: "webapp:${TAG}" ``` -When you run `docker-compose up`, the `web` service defined above uses the +When you run `docker compose up`, the `web` service defined above uses the image `webapp:v1.5`. You can verify this with the -[config command](reference/config.md), which prints your resolved application -config to the terminal: +[convert command](../engine/reference/commandline/compose_convert.md), which prints your resolved application config to the terminal: ```console -$ docker-compose config +$ docker compose convert version: '3' services: @@ -75,7 +74,7 @@ uses that instead: ```console $ export TAG=v2.0 -$ docker-compose config +$ docker compose convert version: '3' services: @@ -92,7 +91,7 @@ appropriately, for example, `.env.ci`, `.env.dev`, `.env.prod`. Passing the file done using the `--env-file` option: ```console -$ docker-compose --env-file ./config/.env.dev up +$ docker compose --env-file ./config/.env.dev up ``` This file path is relative to the current working directory where the Docker Compose @@ -116,7 +115,7 @@ services: The `.env` file is loaded by default: ```console -$ docker-compose config +$ docker compose convert version: '3' services: web: @@ -126,7 +125,7 @@ services: Passing the `--env-file ` argument overrides the default file path: ```console -$ docker-compose --env-file ./config/.env.dev config +$ docker compose --env-file ./config/.env.dev config version: '3' services: web: @@ -136,7 +135,7 @@ services: When an invalid file path is being passed as `--env-file` argument, Compose returns an error: ```console -$ docker-compose --env-file ./doesnotexist/.env.dev config +$ docker compose --env-file ./doesnotexist/.env.dev config ERROR: Couldn't find env file: /home/user/./doesnotexist/.env.dev ``` @@ -184,19 +183,19 @@ web: - web-variables.env ``` -## Set environment variables with 'docker-compose run' +## Set environment variables with 'docker compose run' Similar to `docker run -e`, you can set environment variables on a one-off -container with `docker-compose run -e`: +container with `docker compose run -e`: ```console -$ docker-compose run -e DEBUG=1 web python console.py +$ docker compose run -e DEBUG=1 web python console.py ``` You can also pass a variable from the shell by not giving it a value: ```console -$ docker-compose run -e DEBUG web python console.py +$ docker compose run -e DEBUG web python console.py ``` The value of the `DEBUG` variable in the container is taken from the value for @@ -233,7 +232,7 @@ When you run the container, the environment variable defined in the Compose file takes precedence. ```console -$ docker-compose exec api node +$ docker compose exec api node > process.env.NODE_ENV 'production' diff --git a/compose/faq.md b/compose/faq.md index ceac06c225..c19e12662b 100644 --- a/compose/faq.md +++ b/compose/faq.md @@ -17,7 +17,7 @@ Yes - see [Controlling startup order](startup-order.md). ## Why do my services take 10 seconds to recreate or stop? Compose stop attempts to stop a container by sending a `SIGTERM`. It then waits -for a [default timeout of 10 seconds](reference/stop.md). After the timeout, +for a [default timeout of 10 seconds](../engine/reference/commandline/compose_stop.md). After the timeout, a `SIGKILL` is sent to the container to forcefully kill it. If you are waiting for this timeout, it means that your containers aren't shutting down when they receive the `SIGTERM` signal. diff --git a/compose/reference/build.md b/compose/reference/build.md deleted file mode 100644 index c4cb3df5e6..0000000000 --- a/compose/reference/build.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -description: Build or rebuild services. -keywords: fig, composition, compose, docker, orchestration, cli, build -title: docker-compose build -notoc: true - ---- - -```none -Usage: docker-compose build [options] [--build-arg key=val...] [SERVICE...] - -Options: - --build-arg key=val Set build-time variables for services. - --compress Compress the build context using gzip. - --force-rm Always remove intermediate containers. - -m, --memory MEM Set memory limit for the build container. - --no-cache Do not use cache when building the image. - --no-rm Do not remove intermediate containers after a successful build. - --parallel Build images in parallel. - --progress string Set type of progress output (`auto`, `plain`, `tty`). - --pull Always attempt to pull a newer version of the image. - -q, --quiet Don't print anything to `STDOUT`. -``` - -Services are built once and then tagged, by default as `project_service`. For -example, `composetest_db`. If the Compose file specifies an -[image](../compose-file/compose-file-v3.md#image) name, the image is -tagged with that name, substituting any variables beforehand. See -[variable substitution](../compose-file/compose-file-v3.md#variable-substitution). - -If you change a service's Dockerfile or the contents of its -build directory, run `docker-compose build` to rebuild it. - -## Native build using the docker CLI - -Compose by default uses the `docker` CLI to perform builds (also known as "native -build"). By using the `docker` CLI, Compose can take advantage of features such -as [BuildKit](../../develop/develop-images/build_enhancements.md), which are not -supported by Compose itself. BuildKit is enabled by default on Docker Desktop, -but requires the `DOCKER_BUILDKIT=1` environment variable to be set on other -platforms. - -Refer to the [Compose CLI environment variables](envvars.md#compose_docker_cli_build) -section to learn how to switch between "native build" and "compose build". diff --git a/compose/reference/config.md b/compose/reference/config.md deleted file mode 100644 index f2b2e5c00c..0000000000 --- a/compose/reference/config.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -description: Config validates and view the compose file. -keywords: fig, composition, compose, docker, orchestration, cli, config -title: docker-compose config -notoc: true -redirect_from: -- /compose/reference/bundle/ ---- - -```none -Usage: docker-compose config [options] - -Options: - --resolve-image-digests Pin image tags to digests. - --no-interpolate Don't interpolate environment variables. - -q, --quiet Only validate the configuration, don't print - anything. - --services Print the service names, one per line. - --volumes Print the volume names, one per line. - --hash="*" Print the service config hash, one per line. - Set "service1,service2" for a list of specified services - or use the wildcard symbol to display all services. -``` - -Validate and view the Compose file. diff --git a/compose/reference/create.md b/compose/reference/create.md deleted file mode 100644 index a146010f0b..0000000000 --- a/compose/reference/create.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -description: Create creates containers for a service. -keywords: fig, composition, compose, docker, orchestration, cli, create -title: docker-compose create -notoc: true ---- - -> **This command is deprecated.** Use the [up](up.md) command with `--no-start` -instead. -{: .warning } - -```none -Usage: docker-compose create [options] [SERVICE...] - -Options: - --force-recreate Recreate containers even if their configuration and - image haven't changed. Incompatible with --no-recreate. - --no-recreate If containers already exist, don't recreate them. - Incompatible with --force-recreate. - --no-build Don't build an image, even if it's missing. - --build Build images before creating containers. -``` diff --git a/compose/reference/down.md b/compose/reference/down.md deleted file mode 100644 index f14f040c2d..0000000000 --- a/compose/reference/down.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -description: docker-compose down -keywords: fig, composition, compose, docker, orchestration, cli, down -title: docker-compose down -notoc: true ---- - -```none -Usage: docker-compose down [options] - -Options: - --rmi type Remove images. Type must be one of: - 'all': Remove all images used by any service. - 'local': Remove only images that don't have a - custom tag set by the `image` field. - -v, --volumes Remove named volumes declared in the `volumes` - section of the Compose file and anonymous volumes - attached to containers. - --remove-orphans Remove containers for services not defined in the - Compose file - -t, --timeout TIMEOUT Specify a shutdown timeout in seconds. - (default: 10) -``` - -Stops containers and removes containers, networks, volumes, and images -created by `up`. - -By default, the only things removed are: - -- Containers for services defined in the Compose file -- Networks defined in the `networks` section of the Compose file -- The default network, if one is used - -Networks and volumes defined as `external` are never removed. - -Anonymous volumes are not removed by default. However, as they don't -have a stable name, they will not be automatically mounted by a subsequent -`up`. For data that needs to persist between updates, use host or -named volumes. diff --git a/compose/reference/events.md b/compose/reference/events.md deleted file mode 100644 index 219cb383c0..0000000000 --- a/compose/reference/events.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -description: Receive real time events from containers. -keywords: fig, composition, compose, docker, orchestration, cli, events -title: docker-compose events -notoc: true ---- - -```none -Usage: docker-compose events [options] [SERVICE...] - -Options: - --json Output events as a stream of json objects -``` - -Stream container events for every container in the project. - -With the `--json` flag, a json object is printed one per line with the -format: - -```json -{ - "time": "2015-11-20T18:01:03.615550", - "type": "container", - "action": "create", - "id": "213cf7...5fc39a", - "service": "web", - "attributes": { - "name": "application_web_1", - "image": "alpine:edge" - } -} -``` - -The events that can be received using this can be seen [here](../../engine/reference/commandline/events.md#object-types). diff --git a/compose/reference/exec.md b/compose/reference/exec.md deleted file mode 100644 index cd289ff910..0000000000 --- a/compose/reference/exec.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -description: docker-compose exec -keywords: fig, composition, compose, docker, orchestration, cli, exec -title: docker-compose exec -notoc: true ---- - -```none -Usage: docker-compose exec [options] [-e KEY=VAL...] SERVICE COMMAND [ARGS...] - -Options: - -d, --detach Detached mode: Run command in the background. - --privileged Give extended privileges to the process. - -u, --user USER Run the command as this user. - -T Disable pseudo-tty allocation. By default `docker-compose exec` - allocates a TTY. - --index=index index of the container if there are multiple - instances of a service [default: 1] - -e, --env KEY=VAL Set environment variables (can be used multiple times, - not supported in API < 1.25) - -w, --workdir DIR Path to workdir directory for this command. -``` - -This is the equivalent of `docker exec`. With this subcommand you can run arbitrary -commands in your services. Commands are by default allocating a TTY, so you can -use a command such as `docker-compose exec web sh` to get an interactive prompt. diff --git a/compose/reference/help.md b/compose/reference/help.md deleted file mode 100644 index d30dad17d9..0000000000 --- a/compose/reference/help.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -description: docker-compose help -keywords: fig, composition, compose, docker, orchestration, cli, help -title: docker-compose help -notoc: true ---- - -```none -Usage: docker-compose help [COMMAND] -``` - -Displays help and usage instructions for a command. diff --git a/compose/reference/images.md b/compose/reference/images.md deleted file mode 100644 index 268ede5b4c..0000000000 --- a/compose/reference/images.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -description: Lists images used by the project. -keywords: fig, composition, compose, docker, orchestration, cli, images -title: docker-compose images -notoc: true ---- - -```none -Usage: docker-compose images [options] [SERVICE...] - -Options: - -q, --quiet Only display IDs -``` - -List images used by the created containers. diff --git a/compose/reference/index.md b/compose/reference/index.md index 77a7033ff5..d332ad9e8d 100644 --- a/compose/reference/index.md +++ b/compose/reference/index.md @@ -1,25 +1,37 @@ --- -description: Overview of docker-compose CLI +description: Overview of the Docker Compose CLI keywords: fig, composition, compose, docker, orchestration, cli, reference, docker-compose redirect_from: -- /compose/reference/docker-compose/ - /compose/reference/overview/ -title: Overview of docker-compose CLI +title: Overview of docker compose CLI --- -This page provides the usage information for the `docker-compose` Command. +This page provides the usage information for the `docker compose` Command. + +> Important +> +> The new Compose V2, which supports the `compose` command as part of the Docker +> CLI, is now available. +> +> Compose V2 integrates compose functions into the Docker platform, continuing +> to support most of the previous `docker-compose` features and flags. You can +> run Compose V2 by replacing the hyphen (`-`) with a space, using `docker compose`, +> instead of `docker-compose`. +{: .important} + +For more information about Docker Compose V2 GA, see the blog post [Announcing Compose V2 General Availability](https://www.docker.com/blog/announcing-compose-v2-general-availability/){: target="_blank" rel="noopener" class="_"}. ## Command options overview and help -You can also see this information by running `docker-compose --help` from the +You can also see this information by running `docker compose --help` from the command line. ```none Define and run multi-container applications with Docker. Usage: - docker-compose [-f ...] [--profile ...] [options] [COMMAND] [ARGS...] - docker-compose -h|--help + docker compose [-f ...] [--profile ...] [options] [COMMAND] [ARGS...] + docker compose -h|--help Options: -f, --file FILE Specify an alternate compose file @@ -71,10 +83,10 @@ Commands: top Display the running processes unpause Unpause services up Create and start containers - version Show the Docker-Compose version information + version Show the Docker Compose version information ``` -You can use Docker Compose binary, `docker-compose [-f ...] [options] +You can use Docker Compose binary, `docker compose [-f ...] [options] [COMMAND] [ARGS...]`, to build and manage multiple services in Docker containers. ## Use `-f` to specify name and path of one or more Compose files @@ -91,7 +103,7 @@ add to their predecessors. For example, consider this command line: ```console -$ docker-compose -f docker-compose.yml -f docker-compose.admin.yml run backup_db +$ docker compose -f docker-compose.yml -f docker-compose.admin.yml run backup_db ``` The `docker-compose.yml` file might specify a `webapp` service. @@ -143,14 +155,14 @@ in an environment file. For an example of using the `-f` option at the command line, suppose you are running the [Compose Rails sample](../../samples/rails.md), and have a `docker-compose.yml` file in a directory called `sandbox/rails`. You can -use a command like [docker-compose pull](pull.md) to get the +use a command like [docker compose pull](../../engine/reference/commandline/compose_pull.md) to get the postgres image for the `db` service from anywhere by using the `-f` flag as -follows: `docker-compose -f ~/sandbox/rails/docker-compose.yml pull db` +follows: `docker compose -f ~/sandbox/rails/docker-compose.yml pull db` Here's the full example: ```console -$ docker-compose -f ~/sandbox/rails/docker-compose.yml pull db +$ docker compose -f ~/sandbox/rails/docker-compose.yml pull db Pulling db (postgres:latest)... latest: Pulling from library/postgres ef0380f84d05: Pull complete @@ -178,9 +190,9 @@ directory name. See also the [COMPOSE_PROJECT_NAME environment variable](envvars ## Use `--profile` to specify one or more active profiles -Calling `docker-compose --profile frontend up` will start the services with the +Calling `docker compose --profile frontend up` will start the services with the profile `frontend` and services without specified profiles. You can also enable -multiple profiles, e.g. with `docker-compose --profile frontend --profile debug up` +multiple profiles, e.g. with `docker compose --profile frontend --profile debug up` the profiles `frontend` and `debug` will be enabled. See also [_Using profiles with Compose_](../profiles.md) and the @@ -189,7 +201,7 @@ See also [_Using profiles with Compose_](../profiles.md) and the ## Set up environment variables You can set [environment variables](envvars.md) for various -`docker-compose` options, including the `-f` and `-p` flags. +`docker compose` options, including the `-f` and `-p` flags. For example, the [COMPOSE_FILE environment variable](envvars.md#compose_file) relates to the `-f` flag, and `COMPOSE_PROJECT_NAME` diff --git a/compose/reference/kill.md b/compose/reference/kill.md deleted file mode 100644 index fd15ee9526..0000000000 --- a/compose/reference/kill.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -description: Forces running containers to stop. -keywords: fig, composition, compose, docker, orchestration, cli, kill -title: docker-compose kill -notoc: true ---- - -```none -Usage: docker-compose kill [options] [SERVICE...] - -Options: - -s SIGNAL SIGNAL to send to the container. - Default signal is SIGKILL. -``` - -Forces running containers to stop by sending a `SIGKILL` signal. Optionally the -signal can be passed, for example: - - docker-compose kill -s SIGINT diff --git a/compose/reference/logs.md b/compose/reference/logs.md deleted file mode 100644 index 2fad45cbe3..0000000000 --- a/compose/reference/logs.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -description: Displays log output from services. -keywords: fig, composition, compose, docker, orchestration, cli, logs -title: docker-compose logs -notoc: true ---- - -```none -Usage: docker-compose logs [options] [SERVICE...] - -Options: - --no-color Produce monochrome output. - -f, --follow Follow log output. - -t, --timestamps Show timestamps. - --tail="all" Number of lines to show from the end of the logs - for each container. -``` - -Displays log output from services. diff --git a/compose/reference/pause.md b/compose/reference/pause.md deleted file mode 100644 index bf4665321a..0000000000 --- a/compose/reference/pause.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -description: Pauses running containers for a service. -keywords: fig, composition, compose, docker, orchestration, cli, pause -title: docker-compose pause -notoc: true ---- - -```none -Usage: docker-compose pause [SERVICE...] -``` - -Pauses running containers of a service. They can be unpaused with `docker-compose unpause`. diff --git a/compose/reference/port.md b/compose/reference/port.md deleted file mode 100644 index fa880cef35..0000000000 --- a/compose/reference/port.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -description: Prints the public port for a port bindings. -keywords: fig, composition, compose, docker, orchestration, cli, port -title: docker-compose port -notoc: true ---- - -```none -Usage: docker-compose port [options] SERVICE PRIVATE_PORT - -Options: - --protocol=proto tcp or udp [default: tcp] - --index=index index of the container if there are multiple - instances of a service [default: 1] -``` - -Prints the public port for a port binding. diff --git a/compose/reference/ps.md b/compose/reference/ps.md deleted file mode 100644 index 86bb97aa81..0000000000 --- a/compose/reference/ps.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -description: Lists containers. -keywords: fig, composition, compose, docker, orchestration, cli, ps -title: docker-compose ps -notoc: true ---- - -```none -Usage: docker-compose ps [options] [SERVICE...] - -Options: - -q, --quiet Only display IDs - --services Display services - --filter KEY=VAL Filter services by a property - -a, --all Show all stopped containers (including those created by the run command) -``` - -Lists containers. - -```console -$ docker-compose ps - Name Command State Ports ---------------------------------------------------------------------------------------------- -mywordpress_db_1 docker-entrypoint.sh mysqld Up (healthy) 3306/tcp -mywordpress_wordpress_1 /entrypoint.sh apache2-for ... Restarting 0.0.0.0:8000->80/tcp -``` diff --git a/compose/reference/pull.md b/compose/reference/pull.md deleted file mode 100644 index f91bcdc9a1..0000000000 --- a/compose/reference/pull.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -description: Pulls service images. -keywords: fig, composition, compose, docker, orchestration, cli, pull -title: docker-compose pull -notoc: true ---- - -```none -Usage: docker-compose pull [options] [SERVICE...] - -Options: - --ignore-pull-failures Pull what it can and ignores images with pull failures. - --parallel Deprecated, pull multiple images in parallel (enabled by default). - --no-parallel Disable parallel pulling. - -q, --quiet Pull without printing progress information - --include-deps Also pull services declared as dependencies -``` - -Pulls an image associated with a service defined in a `docker-compose.yml` or `docker-stack.yml` file, but does not start containers based on those images. - -For example, suppose you have this `docker-compose.yml` file from the [Quickstart: Compose and Rails](../../samples/rails.md) sample. - -```yaml -version: '2' -services: - db: - image: postgres - web: - build: . - command: bundle exec rails s -p 3000 -b '0.0.0.0' - volumes: - - .:/myapp - ports: - - "3000:3000" - depends_on: - - db -``` - -If you run `docker-compose pull ServiceName` in the same directory as the `docker-compose.yml` file that defines the service, Docker pulls the associated image. For example, to call the `postgres` image configured as the `db` service in our example, you would run `docker-compose pull db`. - -```console -$ docker-compose pull db -Pulling db (postgres:latest)... -latest: Pulling from library/postgres -cd0a524342ef: Pull complete -9c784d04dcb0: Pull complete -d99dddf7e662: Pull complete -e5bff71e3ce6: Pull complete -cb3e0a865488: Pull complete -31295d654cd5: Pull complete -fc930a4e09f5: Pull complete -8650cce8ef01: Pull complete -61949acd8e52: Pull complete -527a203588c0: Pull complete -26dec14ac775: Pull complete -0efc0ed5a9e5: Pull complete -40cd26695b38: Pull complete -Digest: sha256:fd6c0e2a9d053bebb294bb13765b3e01be7817bf77b01d58c2377ff27a4a46dc -Status: Downloaded newer image for postgres:latest -``` diff --git a/compose/reference/push.md b/compose/reference/push.md deleted file mode 100644 index 1aeb1c945e..0000000000 --- a/compose/reference/push.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -description: Pushes service images. -keywords: fig, composition, compose, docker, orchestration, cli, push -title: docker-compose push -notoc: true ---- - -```none -Usage: docker-compose push [options] [SERVICE...] - -Options: - --ignore-push-failures Push what it can and ignores images with push failures. -``` - -Pushes images for services to their respective `registry/repository`. - -The following assumptions are made: - -- You are pushing an image you have built locally - -- You have access to the build key - -## Example - -```yaml -version: '3' -services: - service1: - build: . - image: localhost:5000/yourimage # goes to local registry - - service2: - build: . - image: your-dockerid/yourimage # goes to your repository on Docker Hub -``` diff --git a/compose/reference/restart.md b/compose/reference/restart.md deleted file mode 100644 index 9bfe4904fd..0000000000 --- a/compose/reference/restart.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -description: Restarts Docker Compose services. -keywords: fig, composition, compose, docker, orchestration, cli, restart -title: docker-compose restart -notoc: true ---- - -```none -Usage: docker-compose restart [options] [SERVICE...] - -Options: - -t, --timeout TIMEOUT Specify a shutdown timeout in seconds. - (default: 10) -``` - -Restarts all stopped and running services. - -If you make changes to your `docker-compose.yml` configuration these changes are not reflected after running this command. - -For example, changes to environment variables (which are added after a container is built, but before the container's command is executed) are not updated after restarting. - -If you are looking to configure a service's restart policy, please refer to -[restart](../compose-file/compose-file-v3.md#restart) in Compose file v3 and -[restart](../compose-file/compose-file-v2.md#restart) in Compose v2. Note that if -you are [deploying a stack in swarm mode](../../engine/reference/commandline/stack_deploy.md), -you should use [restart_policy](../compose-file/compose-file-v3.md#restart_policy), instead. diff --git a/compose/reference/rm.md b/compose/reference/rm.md deleted file mode 100644 index 87c0cf0289..0000000000 --- a/compose/reference/rm.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -description: Removes stopped service containers. -keywords: fig, composition, compose, docker, orchestration, cli, rm -title: docker-compose rm -notoc: true ---- - -```none -Usage: docker-compose rm [options] [SERVICE...] - -Options: - -f, --force Don't ask to confirm removal - -s, --stop Stop the containers, if required, before removing - -v Remove any anonymous volumes attached to containers - -a, --all Deprecated - no effect. -``` - -Removes stopped service containers. - -By default, anonymous volumes attached to containers are not removed. You -can override this with `-v`. To list all volumes, use `docker volume ls`. - -Any data which is not in a volume is lost. - -Running the command with no options also removes one-off containers created -by `docker-compose up` or `docker-compose run`: - -```none -$ docker-compose rm -Going to remove djangoquickstart_web_run_1 -Are you sure? [yN] y -Removing djangoquickstart_web_run_1 ... done -``` \ No newline at end of file diff --git a/compose/reference/run.md b/compose/reference/run.md deleted file mode 100644 index db91213be9..0000000000 --- a/compose/reference/run.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -description: Runs a one-off command on a service. -keywords: fig, composition, compose, docker, orchestration, cli, run -title: docker-compose run -notoc: true ---- - -```none -Usage: - docker-compose run [options] [-v VOLUME...] [-p PORT...] [-e KEY=VAL...] [-l KEY=VALUE...] - SERVICE [COMMAND] [ARGS...] - -Options: - -d, --detach Detached mode: Run container in the background, print - new container name. - --name NAME Assign a name to the container - --entrypoint CMD Override the entrypoint of the image. - -e KEY=VAL Set an environment variable (can be used multiple times) - -l, --label KEY=VAL Add or override a label (can be used multiple times) - -u, --user="" Run as specified username or uid - --no-deps Don't start linked services. - --rm Remove container after run. Ignored in detached mode. - -p, --publish=[] Publish a container's port(s) to the host - --service-ports Run command with the service's ports enabled and mapped - to the host. - --use-aliases Use the service's network aliases in the network(s) the - container connects to. - -v, --volume=[] Bind mount a volume (default []) - -T Disable pseudo-tty allocation. By default `docker-compose run` - allocates a TTY. - -w, --workdir="" Working directory inside the container -``` - -Runs a one-time command against a service. For example, the following command starts the `web` service and runs `bash` as its command. - - docker-compose run web bash - -Commands you use with `run` start in new containers with configuration defined by that of the service, including volumes, links, and other details. However, there are two important differences. - -First, the command passed by `run` overrides the command defined in the service configuration. For example, if the `web` service configuration is started with `bash`, then `docker-compose run web python app.py` overrides it with `python app.py`. - -The second difference is that the `docker-compose run` command does not create any of the ports specified in the service configuration. This prevents port collisions with already-open ports. If you *do want* the service's ports to be created and mapped to the host, specify the `--service-ports` flag: - - docker-compose run --service-ports web python manage.py shell - -Alternatively, manual port mapping can be specified with the `--publish` or `-p` options, just as when using `docker run`: - - docker-compose run --publish 8080:80 -p 2022:22 -p 127.0.0.1:2021:21 web python manage.py shell - -If you start a service configured with links, the `run` command first checks to see if the linked service is running and starts the service if it is stopped. Once all the linked services are running, the `run` executes the command you passed it. For example, you could run: - - docker-compose run db psql -h db -U docker - -This opens an interactive PostgreSQL shell for the linked `db` container. - -If you do not want the `run` command to start linked containers, use the `--no-deps` flag: - - docker-compose run --no-deps web python manage.py shell - -If you want to remove the container after running while overriding the container's restart policy, use the `--rm` flag: - - docker-compose run --rm web python manage.py db upgrade - -This runs a database upgrade script, and removes the container when finished running, even if a restart policy is specified in the service configuration. diff --git a/compose/reference/scale.md b/compose/reference/scale.md deleted file mode 100644 index b5d93c72c6..0000000000 --- a/compose/reference/scale.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -description: Sets the number of containers to run for a service. -keywords: fig, composition, compose, docker, orchestration, cli, scale -title: docker-compose scale -notoc: true ---- - -> **This command is deprecated.** Use the [up](up.md) command with the - `--scale` flag instead. Beware that using `up` with the `--scale` flag has - some [subtle differences](https://github.com/docker/compose/issues/5251) with - the `scale` command, as it incorporates the behaviour of the `up` command. - {: .warning } - -```none -Usage: docker-compose scale [options] [SERVICE=NUM...] - -Options: - -t, --timeout TIMEOUT Specify a shutdown timeout in seconds. - (default: 10) -``` - -Sets the number of containers to run for a service. - -Numbers are specified as arguments in the form `service=num`. For example: - - docker-compose scale web=2 worker=3 - ->**Tip**: Alternatively, in -[Compose file version 3.x](../compose-file/compose-file-v3.md), you can specify -[replicas](../compose-file/compose-file-v3.md#replicas) -under the [deploy](../compose-file/compose-file-v3.md#deploy) key as part of a -service configuration for [Swarm mode](/engine/swarm/). The `deploy` key and its sub-options (including `replicas`) only works with the `docker stack deploy` command, not `docker-compose up` or `docker-compose run`. diff --git a/compose/reference/start.md b/compose/reference/start.md deleted file mode 100644 index 3a2c74f667..0000000000 --- a/compose/reference/start.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -description: Starts existing containers for a service. -keywords: fig, composition, compose, docker, orchestration, cli, start -title: docker-compose start -notoc: true ---- - -```none -Usage: docker-compose start [SERVICE...] -``` - -Starts existing containers for a service. diff --git a/compose/reference/stop.md b/compose/reference/stop.md deleted file mode 100644 index 587eacb564..0000000000 --- a/compose/reference/stop.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -description: 'Stops running containers without removing them. ' -keywords: fig, composition, compose, docker, orchestration, cli, stop -title: docker-compose stop -notoc: true ---- - -```none -Usage: docker-compose stop [options] [SERVICE...] - -Options: - -t, --timeout TIMEOUT Specify a shutdown timeout in seconds. - (default: 10) -``` - -Stops running containers without removing them. They can be started again with -`docker-compose start`. diff --git a/compose/reference/top.md b/compose/reference/top.md deleted file mode 100644 index 0bf3b871a5..0000000000 --- a/compose/reference/top.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -description: Displays the running processes. -keywords: fig, composition, compose, docker, orchestration, cli, top -title: docker-compose top -notoc: true ---- - -```none -Usage: docker-compose top [SERVICE...] -``` - -Displays the running processes. - -```console -$ docker-compose top -compose_service_a_1 -PID USER TIME COMMAND ----------------------------- -4060 root 0:00 top - -compose_service_b_1 -PID USER TIME COMMAND ----------------------------- -4115 root 0:00 top -``` diff --git a/compose/reference/unpause.md b/compose/reference/unpause.md deleted file mode 100644 index 491a006e46..0000000000 --- a/compose/reference/unpause.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -description: Unpauses paused containers for a service. -keywords: fig, composition, compose, docker, orchestration, cli, unpause -title: docker-compose unpause -notoc: true ---- - -```none -Usage: docker-compose unpause [SERVICE...] -``` - -Unpauses paused containers of a service. diff --git a/compose/reference/up.md b/compose/reference/up.md deleted file mode 100644 index 2ca283615c..0000000000 --- a/compose/reference/up.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -description: Builds, (re)creates, starts, and attaches to containers for a service. -keywords: fig, composition, compose, docker, orchestration, cli, up -title: docker-compose up -notoc: true ---- - -```none -Usage: docker-compose up [options] [--scale SERVICE=NUM...] [SERVICE...] - -Options: - -d, --detach Detached mode: Run containers in the background, - print new container names. Incompatible with - --abort-on-container-exit. - --no-color Produce monochrome output. - --quiet-pull Pull without printing progress information - --no-deps Don't start linked services. - --force-recreate Recreate containers even if their configuration - and image haven't changed. - --always-recreate-deps Recreate dependent containers. - Incompatible with --no-recreate. - --no-recreate If containers already exist, don't recreate - them. Incompatible with --force-recreate and - --renew-anon-volumes. - --no-build Don't build an image, even if it's missing. - --no-start Don't start the services after creating them. - --build Build images before starting containers. - --abort-on-container-exit Stops all containers if any container was - stopped. Incompatible with --detach. - --attach-dependencies Attach to dependent containers. - -t, --timeout TIMEOUT Use this timeout in seconds for container - shutdown when attached or when containers are - already running. (default: 10) - -V, --renew-anon-volumes Recreate anonymous volumes instead of retrieving - data from the previous containers. - --remove-orphans Remove containers for services not defined - in the Compose file. - --exit-code-from SERVICE Return the exit code of the selected service - container. Implies --abort-on-container-exit. - --scale SERVICE=NUM Scale SERVICE to NUM instances. Overrides the - `scale` setting in the Compose file if present. -``` - -Builds, (re)creates, starts, and attaches to containers for a service. - -Unless they are already running, this command also starts any linked services. - -The `docker-compose up` command aggregates the output of each container (essentially running `docker-compose logs --follow`). When -the command exits, all containers are stopped. Running `docker-compose up --detach` -starts the containers in the background and leaves them running. - -If there are existing containers for a service, and the service's configuration -or image was changed after the container's creation, `docker-compose up` picks -up the changes by stopping and recreating the containers (preserving mounted -volumes). To prevent Compose from picking up changes, use the `--no-recreate` -flag. - -If you want to force Compose to stop and recreate all containers, use the -`--force-recreate` flag. - -If the process encounters an error, the exit code for this command is `1`. -If the process is interrupted using `SIGINT` (`ctrl` + `C`) or `SIGTERM`, the containers are stopped, and the exit code is `0`. -If `SIGINT` or `SIGTERM` is sent again during this shutdown phase, the running containers are killed, and the exit code is `2`. diff --git a/engine/reference/commandline/compose.md b/engine/reference/commandline/compose.md index 1cbe69f0af..a58ae290d7 100644 --- a/engine/reference/commandline/compose.md +++ b/engine/reference/commandline/compose.md @@ -2,6 +2,9 @@ datafolder: compose-cli datafile: docker_compose title: docker compose +redirect_from: +- /compose/reference/docker-compose/ +- /compose/reference/help/ ---