From 06917b2748a74c514c7ad289afcb736caf3d439e Mon Sep 17 00:00:00 2001 From: Allie Sadler <102604716+aevesdocker@users.noreply.github.com> Date: Fri, 7 Oct 2022 10:15:58 +0100 Subject: [PATCH 1/8] updated getting started guide --- _data/toc.yaml | 2 +- compose/gettingstarted.md | 56 +++++++++++++++++---------------------- 2 files changed, 25 insertions(+), 33 deletions(-) diff --git a/_data/toc.yaml b/_data/toc.yaml index 9a5c297e88ec..d5c37efa7613 100644 --- a/_data/toc.yaml +++ b/_data/toc.yaml @@ -1529,7 +1529,7 @@ manuals: - path: /compose/install/uninstall/ title: Uninstall Docker Compose - path: /compose/gettingstarted/ - title: Getting started + title: Try Docker Compose - sectiontitle: Environment variables section: - path: /compose/environment-variables/ diff --git a/compose/gettingstarted.md b/compose/gettingstarted.md index 49aef459ca57..49765b8f2984 100644 --- a/compose/gettingstarted.md +++ b/compose/gettingstarted.md @@ -1,23 +1,23 @@ --- description: Get started with Docker Compose keywords: documentation, docs, docker, compose, orchestration, containers -title: Get started with Docker Compose +title: Try Docker Compose --- -On this page you build a simple Python web application running on Docker -Compose. The application uses the Flask framework and maintains a hit counter in -Redis. While the sample uses Python, the concepts demonstrated here should be -understandable even if you're not familiar with it. +This tutorial is designed to introduce the key concepts of Docker Compose whilst building a simple Python web application. The application uses the Flask framework and maintains a hit counter in +Redis. + +The concepts demonstrated here should be understandable even if you're not familiar Python. ## Prerequisites -Make sure you have already installed both [Docker Engine](../get-docker.md) -and [Docker Compose](install/index.md). You don't need to install Python or Redis, as -both are provided by Docker images. +You need to have Docker Engine and Docker Compose on your machine. You can either: +- Install [Docker Engine](../get-docker.md) and [Docker Compose](install/index.md) as standalone binaries +- Install [Docker Desktop](../desktop/index.md) which includes both Docker Engine and Docker Compose -## Step 1: Setup +You don't need to install Python or Redis, as both are provided by Docker images. -Define the application dependencies. +## Step 1: Define the application dependencies 1. Create a directory for the project: @@ -26,7 +26,7 @@ Define the application dependencies. $ cd composetest ``` -2. Create a file called `app.py` in your project directory and paste this in: +2. Create a file called `app.py` in your project directory and paste the following code in: ```python import time @@ -62,13 +62,13 @@ Define the application dependencies. > Note the way the `get_hit_count` function is written. This basic retry > loop lets us attempt our request multiple times if the redis service is > not available. This is useful at startup while the application comes - > online, but also makes our application more resilient if the Redis + > online, but also makes the application more resilient if the Redis > service needs to be restarted anytime during the app's lifetime. In a > cluster, this also helps handling momentary connection drops between > nodes. 3. Create another file called `requirements.txt` in your project directory and - paste this in: + paste the following code in: ```text flask @@ -77,12 +77,11 @@ Define the application dependencies. ## Step 2: Create a Dockerfile -In this step, you write a Dockerfile that builds a Docker image. The image +The Dockerfile is used to build a Docker image. The image contains all the dependencies the Python application requires, including Python itself. -In your project directory, create a file named `Dockerfile` and paste the -following: +In your project directory, create a file named `Dockerfile` and paste the following code in: ```dockerfile # syntax=docker/dockerfile:1 @@ -109,6 +108,11 @@ This tells Docker to: * Copy the current directory `.` in the project to the workdir `.` in the image. * Set the default command for the container to `flask run`. +>Important +> +>Check that the `Dockerfile` has no file extension like `.txt`. Some editors may append this file extension automatically and which results in an error when you run the application. +{: .important} + For more information on how to write Dockerfiles, see the [Docker user guide](../develop/index.md) and the [Dockerfile reference](/engine/reference/builder/). @@ -132,13 +136,8 @@ services: This Compose file defines two services: `web` and `redis`. -### Web service - The `web` service uses an image that's built from the `Dockerfile` in the current directory. -It then binds the container and the host machine to the exposed port, `8000`. This example service uses the default port for -the Flask web server, `5000`. - -### Redis service +It then binds the container and the host machine to the exposed port, `8000`. This example service uses the default port for the Flask web server, `5000`. The `redis` service uses a public [Redis](https://registry.hub.docker.com/_/redis/) image pulled from the Docker Hub registry. @@ -175,11 +174,7 @@ image pulled from the Docker Hub registry. 2. Enter http://localhost:8000/ in a browser to see the application running. - If you're using Docker natively on Linux, Docker Desktop for Mac, or Docker Desktop for - Windows, then the web app should now be listening on port 8000 on your - Docker daemon host. Point your web browser to http://localhost:8000 to - find the `Hello World` message. If this doesn't resolve, you can also try - http://127.0.0.1:8000. + If this doesn't resolve, you can also try http://127.0.0.1:8000. You should see a message in your browser saying: @@ -346,12 +341,9 @@ container: $ docker compose down --volumes ``` -At this point, you have seen the basics of how Compose works. - - ## Where to go next -- Next, try the [Sample apps with Compose](samples-for-compose.md) +- Next, try the [Sample apps with Compose](https://github.com/docker/awesome-compose) - [Explore the full list of Compose commands](reference/index.md) -- [Compose configuration file reference](compose-file/index.md) +- [Explore the Compose configuration file reference](compose-file/index.md) - To learn more about volumes and bind mounts, see [Manage data in Docker](../storage/index.md) From e3802d3173f15ba1b28115f7d3a4400295164a1c Mon Sep 17 00:00:00 2001 From: Allie Sadler <102604716+aevesdocker@users.noreply.github.com> Date: Fri, 7 Oct 2022 12:34:00 +0100 Subject: [PATCH 2/8] toc update --- _data/toc.yaml | 10 +- compose/compose-v2/index.md | 45 ++++++ compose/faq.md | 13 ++ compose/how-it-works.md | 146 +++++++++++++++++++ compose/index.md | 270 +++++++++--------------------------- 5 files changed, 277 insertions(+), 207 deletions(-) create mode 100644 compose/compose-v2/index.md create mode 100644 compose/how-it-works.md diff --git a/_data/toc.yaml b/_data/toc.yaml index d5c37efa7613..40ec002f6675 100644 --- a/_data/toc.yaml +++ b/_data/toc.yaml @@ -1518,6 +1518,8 @@ manuals: section: - path: /compose/ title: Overview + - path: /compose/how-it-works/ + title: How does it work? - sectiontitle: Install Docker Compose section: - path: /compose/install/ @@ -1530,6 +1532,12 @@ manuals: title: Uninstall Docker Compose - path: /compose/gettingstarted/ title: Try Docker Compose + - sectiontitle: Compose V2 + section: + - path: /compose/compose-v2/ + title: Overview + - path: /compose/cli-command-compatibility/ + title: Compose v2 compatibility - sectiontitle: Environment variables section: - path: /compose/environment-variables/ @@ -1552,8 +1560,6 @@ manuals: title: Control startup order - path: /compose/samples-for-compose/ title: Sample apps with Compose - - path: /compose/cli-command-compatibility/ - title: Compose v2 compatibility - path: /compose/release-notes/ title: Release notes diff --git a/compose/compose-v2/index.md b/compose/compose-v2/index.md new file mode 100644 index 000000000000..1bc4362857a4 --- /dev/null +++ b/compose/compose-v2/index.md @@ -0,0 +1,45 @@ +--- +description: Key features and use cases of Docker Compose +keywords: documentation, docs, docker, compose, orchestration, containers, uses, features +title: Compose V2 Overview +--- + +## Compose V2 and the new `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} + +If you rely on using Docker Compose as `docker-compose` (with a hyphen), you can +set up Compose V2 to act as a drop-in replacement of the previous `docker-compose`. +Refer to the [Installing Compose](install/index.md) section for detailed instructions. + +## Context of Docker Compose evolution + +Introduction of the [Compose specification](https://github.com/compose-spec/compose-spec){:target="_blank" rel="noopener" class="_"} +makes a clean distinction between the Compose YAML file model and the `docker-compose` +implementation. Making this change has enabled a number of enhancements, including +adding the `compose` command directly into the Docker CLI, being able to "up" a +Compose application on cloud platforms by simply switching the Docker context, +and launching of [Amazon ECS](../cloud/ecs-integration.md) and [Microsoft ACI](../cloud/aci-integration.md). +As the Compose specification evolves, new features land faster in the Docker CLI. + +Compose V2 relies directly on the compose-go bindings which are maintained as part +of the specification. This allows us to include community proposals, experimental +implementations by the Docker CLI and/or Engine, and deliver features faster to +users. Compose V2 also supports some of the newer additions to the specification, +such as [profiles](profiles.md) and [GPU](gpu-support.md) devices. + +Compose V2 has been re-written in [Go](https://go.dev), which improves integration +with other Docker command-line features, and allows it to run natively on +[macOS on Apple silicon](../desktop/mac/apple-silicon.md), Windows, and Linux, +without dependencies such as Python. + +For more information about compatibility with the compose v1 command-line, see the [docker-compose compatibility list](cli-command-compatibility.md). \ No newline at end of file diff --git a/compose/faq.md b/compose/faq.md index d54bc00b703d..eeef5795d92f 100644 --- a/compose/faq.md +++ b/compose/faq.md @@ -112,6 +112,19 @@ the directory contents of the image. There are [many examples of Compose files on GitHub](https://github.com/search?q=in%3Apath+docker-compose.yml+extension%3Ayml&type=Code). +## Getting help + +Docker Compose is under active development. If you need help, would like to +contribute, or simply want to talk about the project with like-minded +individuals, we have a number of open channels for communication. + +* To report bugs or file feature requests: use the [issue tracker on Github](https://github.com/docker/compose/issues). + +* To talk about the project with people in real time: join the + `#docker-compose` channel on the Docker Community Slack. + +* To contribute code or documentation changes: submit a [pull request on Github](https://github.com/docker/compose/pulls). + ## Compose documentation diff --git a/compose/how-it-works.md b/compose/how-it-works.md new file mode 100644 index 000000000000..675d06a5d1d6 --- /dev/null +++ b/compose/how-it-works.md @@ -0,0 +1,146 @@ +--- +description: Key features and use cases of Docker Compose +keywords: documentation, docs, docker, compose, orchestration, containers, uses, features +title: Key features and use cases +--- + +Using Compose is basically a three-step process: + +1. Define your app's environment with a `Dockerfile` so it can be reproduced +anywhere. + +2. Define the services that make up your app in `docker-compose.yml` +so they can be run together in an isolated environment. + +3. Run `docker compose up` and the [Docker compose command](#compose-v2-and-the-new-docker-compose-command) starts and runs your entire app. You can alternatively run `docker-compose up` using Compose standalone(`docker-compose` binary). + +A `docker-compose.yml` looks like this: + +```yaml +version: "{{ site.compose_file_v3 }}" # optional since v1.27.0 +services: + web: + build: . + ports: + - "8000:5000" + volumes: + - .:/code + - logvolume01:/var/log + depends_on: + - redis + redis: + image: redis +volumes: + logvolume01: {} +``` + +For more information about the Compose file, see the +[Compose file reference](compose-file/index.md). + +Compose has commands for managing the whole lifecycle of your application: + + * Start, stop, and rebuild services + * View the status of running services + * Stream the log output of running services + * Run a one-off command on a service + + +## Key features of Docker Compose + +The features of Compose that make it effective are: + +* [Multiple isolated environments on a single host](#multiple-isolated-environments-on-a-single-host) +* [Preserve volume data when containers are created](#preserve-volume-data-when-containers-are-created) +* [Only recreate containers that have changed](#only-recreate-containers-that-have-changed) +* [Variables and moving a composition between environments](#variables-and-moving-a-composition-between-environments) + +### Multiple isolated environments on a single host + +Compose uses a project name to isolate environments from each other. You can make use of this project name in several different contexts: + +* on a dev host, to create multiple copies of a single environment, such as when you want to run a stable copy for each feature branch of a project +* on a CI server, to keep builds from interfering with each other, you can set + the project name to a unique build number +* on a shared host or dev host, to prevent different projects, which may use the + same service names, from interfering with each other + +The default project name is the basename of the project directory. You can set +a custom project name by using the +[`-p` command line option](reference/index.md) or the +[`COMPOSE_PROJECT_NAME` environment variable](reference/envvars.md#compose_project_name). + +The default project directory is the base directory of the Compose file. A custom value +for it can be defined with the `--project-directory` command line option. + + +### Preserve volume data when containers are created + +Compose preserves all volumes used by your services. When `docker compose up` +runs, if it finds any containers from previous runs, it copies the volumes from +the old container to the new container. This process ensures that any data +you've created in volumes isn't lost. + +If you use `docker-compose` on a Windows machine, see +[Environment variables](reference/envvars.md) and adjust the necessary environment +variables for your specific needs. + + +### Only recreate containers that have changed + +Compose caches the configuration used to create a container. When you +restart a service that has not changed, Compose re-uses the existing +containers. Re-using containers means that you can make changes to your +environment very quickly. + + +### Variables and moving a composition between environments + +Compose supports variables in the Compose file. You can use these variables +to customize your composition for different environments, or different users. +See [Variable substitution](compose-file/compose-file-v3.md#variable-substitution) for more +details. + +You can extend a Compose file using the `extends` field or by creating multiple +Compose files. See [extends](extends.md) for more details. + +## Common use cases of Docker Compose + +Compose can be used in many different ways. Some common use cases are outlined +below. + +### Development environments + +When you're developing software, the ability to run an application in an +isolated environment and interact with it is crucial. The Compose command +line tool can be used to create the environment and interact with it. + +The [Compose file](compose-file/index.md) provides a way to document and configure +all of the application's service dependencies (databases, queues, caches, +web service APIs, etc). Using the Compose command line tool you can create +and start one or more containers for each dependency with a single command +(`docker-compose up`). + +Together, these features provide a convenient way for developers to get +started on a project. Compose can reduce a multi-page "developer getting +started guide" to a single machine readable Compose file and a few commands. + +### Automated testing environments + +An important part of any Continuous Deployment or Continuous Integration process +is the automated test suite. Automated end-to-end testing requires an +environment in which to run tests. Compose provides a convenient way to create +and destroy isolated testing environments for your test suite. By defining the full environment in a [Compose file](compose-file/index.md), you can create and destroy these environments in just a few commands: + +```console +$ docker compose up -d +$ ./run_tests +$ docker compose down +``` + +### Single host deployments + +Compose has traditionally been focused on development and testing workflows, +but with each release we're making progress on more production-oriented features. + +For details on using production-oriented features, see +[compose in production](production.md) in this documentation. \ No newline at end of file diff --git a/compose/index.md b/compose/index.md index 512949ec9e12..68f0a4d31bf5 100644 --- a/compose/index.md +++ b/compose/index.md @@ -10,216 +10,76 @@ redirect_from: - /compose/completion/ --- ->**Looking for Compose file reference?** [Find the latest version here](compose-file/index.md). - Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application's services. Then, with a single command, you create and start all the services -from your configuration. To learn more about all the features of Compose, -see [the list of features](#features). +from your configuration. Compose works in all environments: production, staging, development, testing, as -well as CI workflows. You can learn more about each case in [Common Use -Cases](#common-use-cases). - -Using Compose is basically a three-step process: - -1. Define your app's environment with a `Dockerfile` so it can be reproduced -anywhere. - -2. Define the services that make up your app in `docker-compose.yml` -so they can be run together in an isolated environment. - -3. Run `docker compose up` and the [Docker compose command](#compose-v2-and-the-new-docker-compose-command) starts and runs your entire app. You can alternatively run `docker-compose up` using Compose standalone(`docker-compose` binary). - -A `docker-compose.yml` looks like this: - -```yaml -version: "{{ site.compose_file_v3 }}" # optional since v1.27.0 -services: - web: - build: . - ports: - - "8000:5000" - volumes: - - .:/code - - logvolume01:/var/log - depends_on: - - redis - redis: - image: redis -volumes: - logvolume01: {} -``` - -For more information about the Compose file, see the -[Compose file reference](compose-file/index.md). - -Compose has commands for managing the whole lifecycle of your application: - - * Start, stop, and rebuild services - * View the status of running services - * Stream the log output of running services - * Run a one-off command on a service - -## Compose V2 and the new `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} - -If you rely on using Docker Compose as `docker-compose` (with a hyphen), you can -set up Compose V2 to act as a drop-in replacement of the previous `docker-compose`. -Refer to the [Installing Compose](install/index.md) section for detailed instructions. - -## Context of Docker Compose evolution - -Introduction of the [Compose specification](https://github.com/compose-spec/compose-spec){:target="_blank" rel="noopener" class="_"} -makes a clean distinction between the Compose YAML file model and the `docker-compose` -implementation. Making this change has enabled a number of enhancements, including -adding the `compose` command directly into the Docker CLI, being able to "up" a -Compose application on cloud platforms by simply switching the Docker context, -and launching of [Amazon ECS](../cloud/ecs-integration.md) and [Microsoft ACI](../cloud/aci-integration.md). -As the Compose specification evolves, new features land faster in the Docker CLI. - -Compose V2 relies directly on the compose-go bindings which are maintained as part -of the specification. This allows us to include community proposals, experimental -implementations by the Docker CLI and/or Engine, and deliver features faster to -users. Compose V2 also supports some of the newer additions to the specification, -such as [profiles](profiles.md) and [GPU](gpu-support.md) devices. - -Compose V2 has been re-written in [Go](https://go.dev), which improves integration -with other Docker command-line features, and allows it to run natively on -[macOS on Apple silicon](../desktop/mac/apple-silicon.md), Windows, and Linux, -without dependencies such as Python. - -For more information about compatibility with the compose v1 command-line, see the [docker-compose compatibility list](cli-command-compatibility.md). - - -## Features - -The features of Compose that make it effective are: - -* [Multiple isolated environments on a single host](#multiple-isolated-environments-on-a-single-host) -* [Preserve volume data when containers are created](#preserve-volume-data-when-containers-are-created) -* [Only recreate containers that have changed](#only-recreate-containers-that-have-changed) -* [Variables and moving a composition between environments](#variables-and-moving-a-composition-between-environments) - -### Multiple isolated environments on a single host - -Compose uses a project name to isolate environments from each other. You can make use of this project name in several different contexts: - -* on a dev host, to create multiple copies of a single environment, such as when you want to run a stable copy for each feature branch of a project -* on a CI server, to keep builds from interfering with each other, you can set - the project name to a unique build number -* on a shared host or dev host, to prevent different projects, which may use the - same service names, from interfering with each other - -The default project name is the basename of the project directory. You can set -a custom project name by using the -[`-p` command line option](reference/index.md) or the -[`COMPOSE_PROJECT_NAME` environment variable](reference/envvars.md#compose_project_name). - -The default project directory is the base directory of the Compose file. A custom value -for it can be defined with the `--project-directory` command line option. - - -### Preserve volume data when containers are created - -Compose preserves all volumes used by your services. When `docker compose up` -runs, if it finds any containers from previous runs, it copies the volumes from -the old container to the new container. This process ensures that any data -you've created in volumes isn't lost. - -If you use `docker-compose` on a Windows machine, see -[Environment variables](reference/envvars.md) and adjust the necessary environment -variables for your specific needs. - - -### Only recreate containers that have changed - -Compose caches the configuration used to create a container. When you -restart a service that has not changed, Compose re-uses the existing -containers. Re-using containers means that you can make changes to your -environment very quickly. - - -### Variables and moving a composition between environments - -Compose supports variables in the Compose file. You can use these variables -to customize your composition for different environments, or different users. -See [Variable substitution](compose-file/compose-file-v3.md#variable-substitution) for more -details. - -You can extend a Compose file using the `extends` field or by creating multiple -Compose files. See [extends](extends.md) for more details. - - -## Common use cases - -Compose can be used in many different ways. Some common use cases are outlined -below. - -### Development environments - -When you're developing software, the ability to run an application in an -isolated environment and interact with it is crucial. The Compose command -line tool can be used to create the environment and interact with it. - -The [Compose file](compose-file/index.md) provides a way to document and configure -all of the application's service dependencies (databases, queues, caches, -web service APIs, etc). Using the Compose command line tool you can create -and start one or more containers for each dependency with a single command -(`docker-compose up`). - -Together, these features provide a convenient way for developers to get -started on a project. Compose can reduce a multi-page "developer getting -started guide" to a single machine readable Compose file and a few commands. - -### Automated testing environments - -An important part of any Continuous Deployment or Continuous Integration process -is the automated test suite. Automated end-to-end testing requires an -environment in which to run tests. Compose provides a convenient way to create -and destroy isolated testing environments for your test suite. By defining the full environment in a [Compose file](compose-file/index.md), you can create and destroy these environments in just a few commands: - -```console -$ docker compose up -d -$ ./run_tests -$ docker compose down -``` - -### Single host deployments - -Compose has traditionally been focused on development and testing workflows, -but with each release we're making progress on more production-oriented features. - -For details on using production-oriented features, see -[compose in production](production.md) in this documentation. - - -## Release notes - -To see a detailed list of changes for past and current releases of Docker -Compose, refer to the -[CHANGELOG](https://github.com/docker/compose/blob/master/CHANGELOG.md). - -## Getting help - -Docker Compose is under active development. If you need help, would like to -contribute, or simply want to talk about the project with like-minded -individuals, we have a number of open channels for communication. +well as CI workflows. + +
+ +
+
+
+
+ Download and install +
+

Install Docker Compose

+

Follow the instructions on how to install Docker Compose.

+
+
+
+
+
+ Docker Desktop +
+

Try Docker Compose

+

Learn the key concepts of Docker Compose whilst building a simple Python web application.

+
+
+
+
+
+ Release notes +
+

View the release notes

+

Find out about the latest enhancements and bug fixes.

+
+
+
+ +
+
+
+
+ FAQs +
+

Understand how Docker Compose works

+

Understand how Docker Compose works and its key features.

+
+
+
+
+
+ Additional resources +
+

Explore the Compose file reference

+

Find information on defining services, networks, and volumes for a Docker application.

+
+
+
+
+
+ Give feedback +
+

Browse common FAQs

+

Explore general FAQs and find out how to give feedback.

+
+
+
+
-* To report bugs or file feature requests: use the [issue tracker on Github](https://github.com/docker/compose/issues). -* To talk about the project with people in real time: join the - `#docker-compose` channel on the Docker Community Slack. -* To contribute code or documentation changes: submit a [pull request on Github](https://github.com/docker/compose/pulls). From 4aa39167a071f7805241cb13aee7377732243fd5 Mon Sep 17 00:00:00 2001 From: Allie Sadler <102604716+aevesdocker@users.noreply.github.com> Date: Fri, 7 Oct 2022 13:17:08 +0100 Subject: [PATCH 3/8] rearranging --- compose/compose-v2/index.md | 10 +++++----- compose/how-it-works.md | 25 +++++-------------------- compose/index.md | 28 ++++++++++++++++++++-------- 3 files changed, 30 insertions(+), 33 deletions(-) diff --git a/compose/compose-v2/index.md b/compose/compose-v2/index.md index 1bc4362857a4..4e83a57390d7 100644 --- a/compose/compose-v2/index.md +++ b/compose/compose-v2/index.md @@ -19,7 +19,7 @@ title: Compose V2 Overview If you rely on using Docker Compose as `docker-compose` (with a hyphen), you can set up Compose V2 to act as a drop-in replacement of the previous `docker-compose`. -Refer to the [Installing Compose](install/index.md) section for detailed instructions. +Refer to the [Installing Compose](../install/index.md) section for detailed instructions. ## Context of Docker Compose evolution @@ -28,18 +28,18 @@ makes a clean distinction between the Compose YAML file model and the `docker-co implementation. Making this change has enabled a number of enhancements, including adding the `compose` command directly into the Docker CLI, being able to "up" a Compose application on cloud platforms by simply switching the Docker context, -and launching of [Amazon ECS](../cloud/ecs-integration.md) and [Microsoft ACI](../cloud/aci-integration.md). +and launching of [Amazon ECS](../../cloud/ecs-integration.md) and [Microsoft ACI](../../cloud/aci-integration.md). As the Compose specification evolves, new features land faster in the Docker CLI. Compose V2 relies directly on the compose-go bindings which are maintained as part of the specification. This allows us to include community proposals, experimental implementations by the Docker CLI and/or Engine, and deliver features faster to users. Compose V2 also supports some of the newer additions to the specification, -such as [profiles](profiles.md) and [GPU](gpu-support.md) devices. +such as [profiles](../profiles.md) and [GPU](../gpu-support.md) devices. Compose V2 has been re-written in [Go](https://go.dev), which improves integration with other Docker command-line features, and allows it to run natively on -[macOS on Apple silicon](../desktop/mac/apple-silicon.md), Windows, and Linux, +[macOS on Apple silicon](../../desktop/mac/apple-silicon.md), Windows, and Linux, without dependencies such as Python. -For more information about compatibility with the compose v1 command-line, see the [docker-compose compatibility list](cli-command-compatibility.md). \ No newline at end of file +For more information about compatibility with the compose v1 command-line, see the [docker-compose compatibility list](../cli-command-compatibility.md). \ No newline at end of file diff --git a/compose/how-it-works.md b/compose/how-it-works.md index 675d06a5d1d6..4de4892ed313 100644 --- a/compose/how-it-works.md +++ b/compose/how-it-works.md @@ -4,7 +4,7 @@ keywords: documentation, docs, docker, compose, orchestration, containers, uses, title: Key features and use cases --- -Using Compose is basically a three-step process: +Using Compose is essentially a three-step process: 1. Define your app's environment with a `Dockerfile` so it can be reproduced anywhere. @@ -12,7 +12,7 @@ anywhere. 2. Define the services that make up your app in `docker-compose.yml` so they can be run together in an isolated environment. -3. Run `docker compose up` and the [Docker compose command](#compose-v2-and-the-new-docker-compose-command) starts and runs your entire app. You can alternatively run `docker-compose up` using Compose standalone(`docker-compose` binary). +3. Run `docker compose up` and the [Docker compose command](compose-v2/index.md#compose-v2-and-the-new-docker-compose-command) starts and runs your entire app. You can alternatively run `docker-compose up` using Compose standalone(`docker-compose` binary). A `docker-compose.yml` looks like this: @@ -37,24 +37,9 @@ volumes: For more information about the Compose file, see the [Compose file reference](compose-file/index.md). -Compose has commands for managing the whole lifecycle of your application: - - * Start, stop, and rebuild services - * View the status of running services - * Stream the log output of running services - * Run a one-off command on a service - - ## Key features of Docker Compose -The features of Compose that make it effective are: - -* [Multiple isolated environments on a single host](#multiple-isolated-environments-on-a-single-host) -* [Preserve volume data when containers are created](#preserve-volume-data-when-containers-are-created) -* [Only recreate containers that have changed](#only-recreate-containers-that-have-changed) -* [Variables and moving a composition between environments](#variables-and-moving-a-composition-between-environments) - -### Multiple isolated environments on a single host +### Have multiple isolated environments on a single host Compose uses a project name to isolate environments from each other. You can make use of this project name in several different contexts: @@ -73,7 +58,7 @@ The default project directory is the base directory of the Compose file. A custo for it can be defined with the `--project-directory` command line option. -### Preserve volume data when containers are created +### Preserves volume data when containers are created Compose preserves all volumes used by your services. When `docker compose up` runs, if it finds any containers from previous runs, it copies the volumes from @@ -93,7 +78,7 @@ containers. Re-using containers means that you can make changes to your environment very quickly. -### Variables and moving a composition between environments +### Supports variables and moving a composition between environments Compose supports variables in the Compose file. You can use these variables to customize your composition for different environments, or different users. diff --git a/compose/index.md b/compose/index.md index 68f0a4d31bf5..5b4fc25ac5c6 100644 --- a/compose/index.md +++ b/compose/index.md @@ -16,7 +16,19 @@ Then, with a single command, you create and start all the services from your configuration. Compose works in all environments: production, staging, development, testing, as -well as CI workflows. +well as CI workflows, and has commands for managing the whole lifecycle of your application: + + * Start, stop, and rebuild services + * View the status of running services + * Stream the log output of running services + * Run a one-off command on a service + +The key features of Compose that make it effective are: + +* [Have multiple isolated environments on a single host](how-it-works.md#have-multiple-isolated-environments-on-a-single-host) +* [Preserves volume data when containers are created](how-it-works.md#preserves-volume-data-when-containers-are-created) +* [Only recreate containers that have changed](how-it-works.md#only-recreate-containers-that-have-changed) +* [Supports variables and moving a composition between environments](how-it-works.md#supports-variables-and-moving-a-composition-between-environments)
@@ -26,16 +38,16 @@ well as CI workflows.
Download and install
-

Install Docker Compose

+

Install Compose

Follow the instructions on how to install Docker Compose.

- Docker Desktop + Docker Compose
-

Try Docker Compose

+

Try Compose

Learn the key concepts of Docker Compose whilst building a simple Python web application.

@@ -44,7 +56,7 @@ well as CI workflows.
Release notes
-

View the release notes

+

View the release notes

Find out about the latest enhancements and bug fixes.

@@ -56,7 +68,7 @@ well as CI workflows.
FAQs
-

Understand how Docker Compose works

+

Understand how Compose works

Understand how Docker Compose works and its key features.

@@ -65,7 +77,7 @@ well as CI workflows.
Additional resources
-

Explore the Compose file reference

+

Explore the Compose file reference

Find information on defining services, networks, and volumes for a Docker application.

@@ -74,7 +86,7 @@ well as CI workflows.
Give feedback
-

Browse common FAQs

+

Browse common FAQs

Explore general FAQs and find out how to give feedback.

From b25af7423971b59799fae1c3e71c2c538b42e54f Mon Sep 17 00:00:00 2001 From: Allie Sadler <102604716+aevesdocker@users.noreply.github.com> Date: Tue, 11 Oct 2022 09:24:13 +0100 Subject: [PATCH 4/8] fix broken link --- desktop/settings/linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop/settings/linux.md b/desktop/settings/linux.md index 42033a3c5baf..71da2d1e884f 100644 --- a/desktop/settings/linux.md +++ b/desktop/settings/linux.md @@ -34,7 +34,7 @@ On the **General** tab, you can configure when to start Docker and specify other dashboard when starting Docker Desktop. - **Use Docker Compose V2**. Select to enable the `docker-compose` command to - use Docker Compose V2. For more information, see [Docker Compose V2](../../compose/index.md#compose-v2-and-the-new-docker-compose-command). + use Docker Compose V2. For more information, see [Docker Compose V2](../../compose/compose-v2/index.md). ## Resources From eb7e1df7f2cd287ef4e4ba72ba9fcfa85871560e Mon Sep 17 00:00:00 2001 From: Allie Sadler <102604716+aevesdocker@users.noreply.github.com> Date: Tue, 11 Oct 2022 09:34:50 +0100 Subject: [PATCH 5/8] fix broken links --- desktop/settings/mac.md | 2 +- desktop/settings/windows.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/desktop/settings/mac.md b/desktop/settings/mac.md index 54900c0751c8..1d2b32a9cd91 100644 --- a/desktop/settings/mac.md +++ b/desktop/settings/mac.md @@ -45,7 +45,7 @@ On the **General** tab, you can configure when to start Docker and specify other dashboard when starting Docker Desktop. - **Use Docker Compose V2**. Select to enable the `docker-compose` command to - use Docker Compose V2. For more information, see [Docker Compose V2](../../compose/index.md#compose-v2-and-the-new-docker-compose-command). + use Docker Compose V2. For more information, see [Docker Compose V2](../../compose/compose-v2/index.md). ## Resources diff --git a/desktop/settings/windows.md b/desktop/settings/windows.md index 69bd7017107c..46d604d34f6e 100644 --- a/desktop/settings/windows.md +++ b/desktop/settings/windows.md @@ -42,7 +42,7 @@ On the **General** tab, you can configure when to start Docker and specify other dashboard when starting Docker Desktop. - **Use Docker Compose V2**. Select to enable the `docker-compose` command to - use Docker Compose V2. For more information, see [Docker Compose V2](../../compose/index.md#compose-v2-and-the-new-docker-compose-command). + use Docker Compose V2. For more information, see [Docker Compose V2](../../compose/compose-v2/index.md). ## Resources From 91f2886361af62a9d7dda943e33631e06b35b757 Mon Sep 17 00:00:00 2001 From: Allie Sadler <102604716+aevesdocker@users.noreply.github.com> Date: Tue, 11 Oct 2022 09:59:09 +0100 Subject: [PATCH 6/8] naming tweaks --- _data/toc.yaml | 4 ++-- compose/{how-it-works.md => features-uses.md} | 0 compose/index.md | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) rename compose/{how-it-works.md => features-uses.md} (100%) diff --git a/_data/toc.yaml b/_data/toc.yaml index 40ec002f6675..c6274854723d 100644 --- a/_data/toc.yaml +++ b/_data/toc.yaml @@ -1518,8 +1518,8 @@ manuals: section: - path: /compose/ title: Overview - - path: /compose/how-it-works/ - title: How does it work? + - path: /compose/features-uses/ + title: Key features and use cases - sectiontitle: Install Docker Compose section: - path: /compose/install/ diff --git a/compose/how-it-works.md b/compose/features-uses.md similarity index 100% rename from compose/how-it-works.md rename to compose/features-uses.md diff --git a/compose/index.md b/compose/index.md index 5b4fc25ac5c6..a85f37dd0fe3 100644 --- a/compose/index.md +++ b/compose/index.md @@ -68,8 +68,8 @@ The key features of Compose that make it effective are:
FAQs
-

Understand how Compose works

-

Understand how Docker Compose works and its key features.

+

Understand key features of Compose

+

Understand its key features and explore common use casess.

From 09c1e1c22bd21d3beeab637d45922934c23cd336 Mon Sep 17 00:00:00 2001 From: Allie Sadler <102604716+aevesdocker@users.noreply.github.com> Date: Tue, 11 Oct 2022 10:04:37 +0100 Subject: [PATCH 7/8] links fix --- compose/index.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/compose/index.md b/compose/index.md index a85f37dd0fe3..0eac2fbdde05 100644 --- a/compose/index.md +++ b/compose/index.md @@ -25,10 +25,10 @@ well as CI workflows, and has commands for managing the whole lifecycle of your The key features of Compose that make it effective are: -* [Have multiple isolated environments on a single host](how-it-works.md#have-multiple-isolated-environments-on-a-single-host) -* [Preserves volume data when containers are created](how-it-works.md#preserves-volume-data-when-containers-are-created) -* [Only recreate containers that have changed](how-it-works.md#only-recreate-containers-that-have-changed) -* [Supports variables and moving a composition between environments](how-it-works.md#supports-variables-and-moving-a-composition-between-environments) +* [Have multiple isolated environments on a single host](features-uses.md#have-multiple-isolated-environments-on-a-single-host) +* [Preserves volume data when containers are created](features-uses.md#preserves-volume-data-when-containers-are-created) +* [Only recreate containers that have changed](features-uses.md#only-recreate-containers-that-have-changed) +* [Supports variables and moving a composition between environments](features-uses.md#supports-variables-and-moving-a-composition-between-environments)
@@ -68,7 +68,7 @@ The key features of Compose that make it effective are:
FAQs
-

Understand key features of Compose

+

Understand key features of Compose

Understand its key features and explore common use casess.

From 1b14251df93a06cf000e985eade4f79d8ca98984 Mon Sep 17 00:00:00 2001 From: Allie Sadler <102604716+aevesdocker@users.noreply.github.com> Date: Thu, 20 Oct 2022 08:47:52 +0100 Subject: [PATCH 8/8] add icon links --- compose/index.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/compose/index.md b/compose/index.md index 0eac2fbdde05..4ec92ce0140b 100644 --- a/compose/index.md +++ b/compose/index.md @@ -16,7 +16,7 @@ Then, with a single command, you create and start all the services from your configuration. Compose works in all environments: production, staging, development, testing, as -well as CI workflows, and has commands for managing the whole lifecycle of your application: +well as CI workflows. It also has commands for managing the whole lifecycle of your application: * Start, stop, and rebuild services * View the status of running services @@ -36,7 +36,7 @@ The key features of Compose that make it effective are:
- Download and install + Download and install

Install Compose

Follow the instructions on how to install Docker Compose.

@@ -45,7 +45,7 @@ The key features of Compose that make it effective are:
- Docker Compose + Docker Compose

Try Compose

Learn the key concepts of Docker Compose whilst building a simple Python web application.

@@ -54,7 +54,7 @@ The key features of Compose that make it effective are:
- Release notes + Release notes

View the release notes

Find out about the latest enhancements and bug fixes.

@@ -66,16 +66,16 @@ The key features of Compose that make it effective are:
- FAQs + FAQs

Understand key features of Compose

-

Understand its key features and explore common use casess.

+

Understand its key features and explore common use cases.

- Additional resources + Additional resources

Explore the Compose file reference

Find information on defining services, networks, and volumes for a Docker application.

@@ -84,7 +84,7 @@ The key features of Compose that make it effective are:
- Give feedback + Give feedback

Browse common FAQs

Explore general FAQs and find out how to give feedback.