From 868ef67f169acd4b6b3e87ba02519feba4d0d6a5 Mon Sep 17 00:00:00 2001 From: Sarah Sanders Date: Mon, 2 Dec 2024 08:12:41 -0800 Subject: [PATCH 1/7] Update callouts for pull rate limits in Docker Hub (#21494) ## Description - Callouts in https://docs.docker.com/docker-hub/download-rate-limit/#rate-limit were confusing, the callout for DCP stated the *new* rate limits, while the rate limit section explains the existing rate limits - Updated callout to reflect the rate limits are for DCP changes - Clarified the existing table is for existing Docker plans - See: https://docker.atlassian.net/browse/IN-5058 for context ## Related issues or tickets [ENGDOCS-2326](https://docker.atlassian.net/browse/ENGDOCS-2326?atlOrigin=eyJpIjoiZTBjNjBjZmE2ZGYxNDk5MWIzYzNmN2YxOTllZDdiNDYiLCJwIjoiaiJ9) ## Reviews - [ ] Technical review - [ ] Editorial review [ENGDOCS-2326]: https://docker.atlassian.net/browse/ENGDOCS-2326?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ --- content/manuals/docker-hub/download-rate-limit.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/content/manuals/docker-hub/download-rate-limit.md b/content/manuals/docker-hub/download-rate-limit.md index 41672c674e07..7d3f3db242c0 100644 --- a/content/manuals/docker-hub/download-rate-limit.md +++ b/content/manuals/docker-hub/download-rate-limit.md @@ -179,18 +179,19 @@ URLs (`/v2/*/manifests/*`). > different architecture. > - Pulls are accounted to the user doing the pull, not to the owner of the > image. -> -> There will be no image pull rate limit for users or automated systems with a -> paid subscription. Anonymous and Docker Personal users using Docker Hub will -> experience rate limits on image pull requests. For authenticated users, there -> will be a 40 pull/hour rate limit per user; for unauthenticated usage, there -> will be a 10 pull/hour rate limit per IP address. ### What's the download rate limit on Docker Hub? +> [!IMPORTANT] +> +> After March 3rd, 2025, with Docker's enhanced subscription plans, there will be no image pull rate limit for users or automated systems with a +> paid subscription. +> +> Anonymous and Docker Personal users using Docker Hub will experience rate limits on image pull requests. For authenticated users, there will be a 40 pull/hour rate limit per user; for unauthenticated usage, there will be a 10 pull/hour rate limit per IP address. + Docker Hub limits the number of Docker image downloads, or pulls, based on the account type of the user pulling the image. Pull rate limits are based on -individual IP address. +individual IP address. The following table reflects Docker's current rate limits: | User type | Rate limit | |-------------------------------------------------------------------------|--------------------------------------| From b71dec951703383adfe610b69284b38f475dfa80 Mon Sep 17 00:00:00 2001 From: Craig Date: Mon, 2 Dec 2024 13:39:28 -0800 Subject: [PATCH 2/7] samples: add redirect Signed-off-by: Craig --- content/reference/samples/postgres.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/reference/samples/postgres.md b/content/reference/samples/postgres.md index f883a0e072b3..b3dd8d7a6ce0 100644 --- a/content/reference/samples/postgres.md +++ b/content/reference/samples/postgres.md @@ -5,5 +5,5 @@ service: postgresql aliases: - /engine/examples/postgresql_service/ - /samples/postgresql_service/ -- /samples/postgresql/ +- /samples/postgres/ --- From ff09b522683e7c52a8ff0aed80388d06aa84478e Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Tue, 3 Dec 2024 13:38:00 +0100 Subject: [PATCH 3/7] Update best-practices.md (#21045) ## Description Adding `--no-install-recommends` is a common best practice and can massively reduce image sizes. Since people copy from this page it is good to add. --- .../manuals/build/building/best-practices.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/content/manuals/build/building/best-practices.md b/content/manuals/build/building/best-practices.md index c3d42b9a9659..8a099fbb6b7e 100644 --- a/content/manuals/build/building/best-practices.md +++ b/content/manuals/build/building/best-practices.md @@ -98,7 +98,7 @@ download of base images and dependencies. ```dockerfile # syntax=docker/dockerfile:1 FROM ubuntu:24.04 -RUN apt-get -y update && apt-get install -y python +RUN apt-get -y update && apt-get install -y --no-install-recommends python3 ``` Also consider [pinning base image versions](#pin-base-image-versions). @@ -165,7 +165,7 @@ review. Adding a space before a backslash (`\`) helps as well. Here’s an example from the [buildpack-deps image](https://github.com/docker-library/buildpack-deps): ```dockerfile -RUN apt-get update && apt-get install -y \ +RUN apt-get update && apt-get install -y --no-install-recommends \ bzr \ cvs \ git \ @@ -322,7 +322,7 @@ For example, you can chain commands with the `&&` operator, and use escape characters to break long commands into multiple lines. ```dockerfile -RUN apt-get update && apt-get install -y \ +RUN apt-get update && apt-get install -y --no-install-recommends \ package-bar \ package-baz \ package-foo @@ -337,7 +337,7 @@ with a pipeline operator: ```dockerfile RUN < Date: Wed, 4 Dec 2024 08:40:22 +0000 Subject: [PATCH 4/7] ENGDOCS-2341 (#21556) ## Description Compose freshness ## Related issues or tickets ## Reviews - [ ] Technical review - [ ] Editorial review - [ ] Product review --- _vale/config/vocabularies/Docker/accept.txt | 1 + .../how-tos/environment-variables/envvars.md | 108 ++++++++++-------- content/manuals/compose/install/_index.md | 19 +-- content/manuals/compose/install/linux.md | 27 ++--- content/manuals/compose/install/standalone.md | 55 +++++---- content/manuals/compose/install/uninstall.md | 17 ++- 6 files changed, 126 insertions(+), 101 deletions(-) diff --git a/_vale/config/vocabularies/Docker/accept.txt b/_vale/config/vocabularies/Docker/accept.txt index e3cd77f88634..1d27134ebbd9 100644 --- a/_vale/config/vocabularies/Docker/accept.txt +++ b/_vale/config/vocabularies/Docker/accept.txt @@ -113,6 +113,7 @@ Zsh [Nn]amespace [Oo]nboarding [Pp]aravirtualization +[Pp]repend [Pp]rocfs [Pp]roxied [Pp]roxying diff --git a/content/manuals/compose/how-tos/environment-variables/envvars.md b/content/manuals/compose/how-tos/environment-variables/envvars.md index 668ccbb678a1..a0fa287780ea 100644 --- a/content/manuals/compose/how-tos/environment-variables/envvars.md +++ b/content/manuals/compose/how-tos/environment-variables/envvars.md @@ -13,15 +13,14 @@ Compose already comes with pre-defined environment variables. It also inherits c This page contains information on how you can set or change the following pre-defined environment variables if you need to: -- `COMPOSE_CONVERT_WINDOWS_PATHS` +- `COMPOSE_PROJECT_NAME` - `COMPOSE_FILE` - `COMPOSE_PROFILES` -- `COMPOSE_PROJECT_NAME` -- `DOCKER_CERT_PATH` -- `COMPOSE_PARALLEL_LIMIT` +- `COMPOSE_CONVERT_WINDOWS_PATHS` +- `COMPOSE_PATH_SEPARATOR` - `COMPOSE_IGNORE_ORPHANS` - `COMPOSE_REMOVE_ORPHANS` -- `COMPOSE_PATH_SEPARATOR` +- `COMPOSE_PARALLEL_LIMIT` - `COMPOSE_ANSI` - `COMPOSE_STATUS_STDOUT` - `COMPOSE_ENV_FILES` @@ -68,29 +67,35 @@ See also the [command-line options overview](/reference/cli/docker/compose/_inde Specifies the path to a Compose file. Specifying multiple Compose files is supported. -- Default behavior: If not provided, Compose looks for a file named `compose.yaml` or `docker-compose.yaml` in the current directory and, if not found, then Compose searches each parent directory recursively until a file by that name is found. -- Default separator: When specifying multiple Compose files, the path separators are, by default, on: - * Mac and Linux: `:` (colon), - * Windows: `;` (semicolon). +- Default behavior: If not provided, Compose looks for a file named `compose.yaml` in the current directory and, if not found, then Compose searches each parent directory recursively until a file by that name is found. +- When specifying multiple Compose files, the path separators are, by default, on: + - Mac and Linux: `:` (colon) + - Windows: `;` (semicolon) + For example: -The path separator can also be customized using `COMPOSE_PATH_SEPARATOR`. - -Example: `COMPOSE_FILE=docker-compose.yml:docker-compose.prod.yml`. + ```console + COMPOSE_FILE=docker-compose.yml:docker-compose.prod.yml + ``` + The path separator can also be customized using [`COMPOSE_PATH_SEPARATOR`](#compose_path_separator). See also the [command-line options overview](/reference/cli/docker/compose/_index.md#command-options-overview-and-help) and [using `-f` to specify name and path of one or more Compose files](/reference/cli/docker/compose/_index.md#use--f-to-specify-name-and-path-of-one-or-more-compose-files). ### COMPOSE\_PROFILES -Specifies one or more profiles to be enabled on `compose up` execution. +Specifies one or more profiles to be enabled when `docker compose up` is run. + Services with matching profiles are started as well as any services for which no profile has been defined. For example, calling `docker compose up`with `COMPOSE_PROFILES=frontend` selects services with the `frontend` profile as well as any services without a profile specified. -* Default separator: specify a list of profiles using a comma as separator. +If specifying multiple profiles, use a comma as a separator. -Example: `COMPOSE_PROFILES=frontend,debug` -This example enables all services matching both the `frontend` and `debug` profiles and services without a profile. +This following example enables all services matching both the `frontend` and `debug` profiles and services without a profile. + +```console +COMPOSE_PROFILES=frontend,debug +``` See also [Using profiles with Compose](../profiles.md) and the [`--profile` command-line option](/reference/cli/docker/compose/_index.md#use---profile-to-specify-one-or-more-active-profiles). @@ -98,27 +103,36 @@ See also [Using profiles with Compose](../profiles.md) and the [`--profile` comm When enabled, Compose performs path conversion from Windows-style to Unix-style in volume definitions. -* Supported values: - * `true` or `1`, to enable, - * `false` or `0`, to disable. -* Defaults to: `0`. +- Supported values: + - `true` or `1`, to enable + - `false` or `0`, to disable +- Defaults to: `0` ### COMPOSE\_PATH\_SEPARATOR Specifies a different path separator for items listed in `COMPOSE_FILE`. -* Defaults to: - * On macOS and Linux to `:`, - * On Windows to`;`. +- Defaults to: + - On macOS and Linux to `:` + - On Windows to`;` ### COMPOSE\_IGNORE\_ORPHANS When enabled, Compose doesn't try to detect orphaned containers for the project. -* Supported values: - * `true` or `1`, to enable, - * `false` or `0`, to disable. -* Defaults to: `0`. +- Supported values: + - `true` or `1`, to enable + - `false` or `0`, to disable +- Defaults to: `0` + +### COMPOSE\_REMOVE\_ORPHANS + +When enabled, Compose automatically removes orphaned containers when updating a service or stack. Orphaned containers are those that were created by a previous configuration but are no longer defined in the current `compose.yaml` file. + +- Supported values: + - `true` or `1`, to enable automatic removal of orphaned containers + - `false` or `0`, to disable automatic removal. Compose displays a warning about orphaned containers instead. +- Defaults to: `0` ### COMPOSE\_PARALLEL\_LIMIT @@ -128,27 +142,27 @@ Specifies the maximum level of parallelism for concurrent engine calls. Specifies when to print ANSI control characters. -* Supported values: - * `auto`, Compose detects if TTY mode can be used. Otherwise, use plain text mode. - * `never`, use plain text mode. - * `always` or `0`, use TTY mode. -* Defaults to: `auto`. +- Supported values: + - `auto`, Compose detects if TTY mode can be used. Otherwise, use plain text mode + - `never`, use plain text mode + - `always` or `0`, use TTY mode +- Defaults to: `auto` ### COMPOSE\_STATUS\_STDOUT When enabled, Compose writes its internal status and progress messages to `stdout` instead of `stderr`. The default value is false to clearly separate the output streams between Compose messages and your container's logs. -* Supported values: - * `true` or `1`, to enable, - * `false` or `0`, to disable. -* Defaults to: `0`. +- Supported values: + - `true` or `1`, to enable + - `false` or `0`, to disable +- Defaults to: `0` ### COMPOSE\_ENV\_FILES Lets you specify which environment files Compose should use if `--env-file` isn't used. -When using multiple environment files, use a comma as a separator. For example, +When using multiple environment files, use a comma as a separator. For example: ```console COMPOSE_ENV_FILES=.env.envfile1, .env.envfile2 @@ -158,25 +172,25 @@ If `COMPOSE_ENV_FILES` is not set, and you don't provide `--env-file` in the CLI ### COMPOSE\_MENU -> Available in Docker Compose version [2.26.0](/manuals/compose/releases/release-notes.md#2260) and later, and Docker Desktop version 4.29 and later. +{{< introduced compose 2.26.0 "/manuals/compose/releases/release-notes.md#2260" >}} When enabled, Compose displays a navigation menu where you can choose to open the Compose stack in Docker Desktop, switch on [`watch` mode](../file-watch.md), or use [Docker Debug](/reference/cli/docker/debug.md). -* Supported values: - * `true` or `1`, to enable, - * `false` or `0`, to disable. -* Defaults to: `1` if you obtained Docker Compose through Docker Desktop, otherwise default is `0`. +- Supported values: + - `true` or `1`, to enable + - `false` or `0`, to disable +- Defaults to: `1` if you obtained Docker Compose through Docker Desktop, otherwise default is `0` ### COMPOSE\_EXPERIMENTAL -> Available in Docker Compose version [2.26.0](/manuals/compose/releases/release-notes.md#2260) and later, and Docker Desktop version 4.29 and later. +{{< introduced compose 2.26.0 "/manuals/compose/releases/release-notes.md#2260" >}} This is an opt-out variable. When turned off it deactivates the experimental features such as the navigation menu or [Synchronized file shares](/manuals/desktop/features/synchronized-file-sharing.md). -* Supported values: - * `true` or `1`, to enable, - * `false` or `0`, to disable. -* Defaults to: `1`. +- Supported values: + - `true` or `1`, to enable + - `false` or `0`, to disable +- Defaults to: `1` ## Unsupported in Compose V2 diff --git a/content/manuals/compose/install/_index.md b/content/manuals/compose/install/_index.md index f6d401d5edd5..8e24ad484bad 100644 --- a/content/manuals/compose/install/_index.md +++ b/content/manuals/compose/install/_index.md @@ -43,20 +43,21 @@ If you have already installed Docker Desktop, you can check which version of Com > ``` > Or enable [Automatically check configuration](/manuals/desktop/settings-and-maintenance/settings.md) which will detect and fix it for you. -### Scenario two: Install the Compose plugin - -If you already have Docker Engine and Docker CLI installed, you can install the Compose plugin from the command line, by either: -- [Using Docker's repository](linux.md#install-using-the-repository) -- [Downloading and installing manually](linux.md#install-the-plugin-manually) +### Scenario two: Install the Docker Compose plugin > [!IMPORTANT] > ->This is only available on Linux +> This install scenario is only available on Linux. -### Scenario three: Install the Compose standalone +If you already have Docker Engine and Docker CLI installed, you can install the Docker Compose plugin from the command line, by either: +- [Using Docker's repository](linux.md#install-using-the-repository) +- [Downloading and installing manually](linux.md#install-the-plugin-manually) -You can [install the Compose standalone](standalone.md) on Linux or on Windows Server. +### Scenario three: Install the Docker Compose standalone > [!WARNING] > ->This install scenario is not recommended and is only supported for backward compatibility purposes. +> This install scenario is not recommended and is only supported for backward compatibility purposes. + +You can [install the Docker Compose standalone](standalone.md) on Linux or on Windows Server. + diff --git a/content/manuals/compose/install/linux.md b/content/manuals/compose/install/linux.md index 22866f705fcd..c8d68c2526d5 100644 --- a/content/manuals/compose/install/linux.md +++ b/content/manuals/compose/install/linux.md @@ -6,22 +6,23 @@ keywords: install docker compose linux, docker compose linux, docker compose plu linux install docker-compose, linux docker compose, docker compose v2 linux, install docker compose on linux toc_max: 3 -title: Install the Compose plugin +title: Install the Docker Compose plugin +linkTitle: Plugin aliases: - /compose/compose-plugin/ - /compose/compose-linux/ +weight: 10 --- -On this page you can find instructions on how to install the Compose plugin on Linux from the command line. +This page contains instructions on how to install the Docker Compose plugin on Linux from the command line. -To install the Compose plugin on Linux, you can either: +To install the Docker Compose plugin on Linux, you can either: - [Set up Docker's repository on your Linux system](#install-using-the-repository). -- [Install Compose manually](#install-the-plugin-manually). +- [Install manually](#install-the-plugin-manually). > [!NOTE] > -> These instructions assume you already have Docker Engine and Docker CLI installed and now want to install the Compose plugin. -For Compose standalone, see [Install Compose Standalone](standalone.md). +> These instructions assume you already have Docker Engine and Docker CLI installed and now want to install the Docker Compose plugin. For the Docker Compose standalone, see [Install the Docker Compose Standalone](standalone.md). ## Install using the repository @@ -64,9 +65,9 @@ For Compose standalone, see [Install Compose Standalone](standalone.md). Where `vN.N.N` is placeholder text standing in for the latest version. -### Update Compose +### Update Docker Compose -To update the Compose plugin, run the following commands: +To update the Docker Compose plugin, run the following commands: * For Ubuntu and Debian, run: @@ -85,9 +86,9 @@ To update the Compose plugin, run the following commands: > [!NOTE] > -> This option requires you to manage upgrades manually. We recommend setting up Docker's repository for easier maintenance. +> This option requires you to manage upgrades manually. It is recommended that you set up Docker's repository for easier maintenance. -1. To download and install the Compose CLI plugin, run: +1. To download and install the Docker Compose CLI plugin, run: ```console $ DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker} @@ -95,11 +96,11 @@ To update the Compose plugin, run the following commands: $ curl -SL https://github.com/docker/compose/releases/download/{{% param "compose_version" %}}/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose ``` - This command downloads the latest release of Docker Compose (from the Compose releases repository) and installs Compose for the active user under `$HOME` directory. + This command downloads and installs the latest release of Docker Compose for the active user under `$HOME` directory. To install: - * Docker Compose for _all users_ on your system, replace `~/.docker/cli-plugins` with `/usr/local/lib/docker/cli-plugins`. - * A different version of Compose, substitute `{{% param "compose_version" %}}` with the version of Compose you want to use. + - Docker Compose for _all users_ on your system, replace `~/.docker/cli-plugins` with `/usr/local/lib/docker/cli-plugins`. + - A different version of Compose, substitute `{{% param "compose_version" %}}` with the version of Compose you want to use. - For a different architecture, substitute `x86_64` with the [architecture you want](https://github.com/docker/compose/releases). diff --git a/content/manuals/compose/install/standalone.md b/content/manuals/compose/install/standalone.md index f9209eec07fd..9e7ff3a02d41 100644 --- a/content/manuals/compose/install/standalone.md +++ b/content/manuals/compose/install/standalone.md @@ -1,57 +1,66 @@ --- -title: Install Compose standalone +title: Install the Docker Compose standalone +linkTitle: Standalone description: How to install Docker Compose - Other Scenarios keywords: compose, orchestration, install, installation, docker, documentation toc_max: 3 +weight: 20 --- -On this page you can find instructions on how to install Compose standalone on Linux or Windows Server, from the command line. - -### On Linux +This page contains instructions on how to install Docker Compose standalone on Linux or Windows Server, from the command line. > [!WARNING] > -> Note that Compose standalone uses the `-compose` syntax instead of the current standard syntax `compose`. ->For example type `docker-compose up` when using Compose standalone, instead of `docker compose up`. +> The Docker Compose standalone uses the `-compose` syntax instead of the current standard syntax `compose`. +> For example, you must type `docker-compose up` when using Docker Compose standalone, instead of `docker compose up`. + +## On Linux + +1. To download and install the Docker Compose standalone, run: -1. To download and install Compose standalone, run: ```console $ curl -SL https://github.com/docker/compose/releases/download/{{% param "compose_version" %}}/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose ``` + 2. Apply executable permissions to the standalone binary in the target path for the installation. + ```console $ chmod +x /usr/local/bin/docker-compose ``` -3. Test and execute Compose commands using `docker-compose`. - > [!TIP] - > - > If the command `docker-compose` fails after installation, check your path. - > You can also create a symbolic link to `/usr/bin` or any other directory in your path. - > For example: - > ```console - > $ sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose - > ``` +3. Test and execute Docker Compose commands using `docker-compose`. -### On Windows Server +> [!TIP] +> +> If the command `docker-compose` fails after installation, check your path. +> You can also create a symbolic link to `/usr/bin` or any other directory in your path. +> For example: +> ```console +> $ sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose +> ``` + +## On Windows Server -Follow these instructions if you are running the Docker daemon and client directly -on Microsoft Windows Server and want to install Docker Compose. +Follow these instructions if you are [running the Docker daemon directly +on Microsoft Windows Server](/manuals/engine/install/binaries.md#install-server-and-client-binaries-on-windows) and want to install Docker Compose. 1. Run PowerShell as an administrator. - When asked if you want to allow this app to make changes to your device, select **Yes** in order to proceed with the installation. + In order to proceed with the installation, select **Yes** when asked if you want this app to make changes to your device. -2. GitHub now requires TLS1.2. In PowerShell, run the following: +2. Optional. Ensure TLS1.2 is enabled. + GitHub requires TLS1.2 fore secure connections. If you’re using an older version of Windows Server, for example 2016, or suspect that TLS1.2 is not enabled, run the following command in PowerShell: ```powershell [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ``` -3. Run the following command to download the latest release of Compose ({{% param "compose_version" %}}): + +3. Download the latest release of Docker Compose ({{% param "compose_version" %}}). Run the following command: ```powershell Start-BitsTransfer -Source "https://github.com/docker/compose/releases/download/{{% param "compose_version" %}}/docker-compose-windows-x86_64.exe" -Destination $Env:ProgramFiles\Docker\docker-compose.exe ``` - To install a different version of Compose, substitute `{{% param "compose_version" %}}` with the version of Compose you want to use. + + To install a different version of Docker Compose, substitute `{{% param "compose_version" %}}` with the version of Compose you want to use. > [!NOTE] > diff --git a/content/manuals/compose/install/uninstall.md b/content/manuals/compose/install/uninstall.md index 2c5ad0cb7cb1..8cda6ca42bc9 100644 --- a/content/manuals/compose/install/uninstall.md +++ b/content/manuals/compose/install/uninstall.md @@ -9,15 +9,15 @@ Uninstalling Docker Compose depends on the method you have used to install Docke ## Uninstalling Docker Desktop -If you want to uninstall Compose and you have installed Docker Desktop, see [Uninstall Docker Desktop](/manuals/desktop/uninstall.md). +If you want to uninstall Docker Compose and you have installed Docker Desktop, see [Uninstall Docker Desktop](/manuals/desktop/uninstall.md). > [!NOTE] > -> Unless you have other Docker instances installed on that specific environment, you would be removing Docker altogether by uninstalling the Desktop. +> Unless you have other Docker instances installed on that specific environment, you would be removing Docker altogether by uninstalling Docker Desktop. ## Uninstalling the Docker Compose CLI plugin -To remove the Compose CLI plugin, run: +To remove the Docker Compose CLI plugin, run: Ubuntu, Debian: @@ -32,7 +32,7 @@ RPM-based distributions: ### Manually installed -If you used `curl` to install Compose CLI plugin, to uninstall it, run: +If you used `curl` to install Docker Compose CLI plugin, to uninstall it, run: ```console $ rm $DOCKER_CONFIG/cli-plugins/docker-compose @@ -40,7 +40,7 @@ If you used `curl` to install Compose CLI plugin, to uninstall it, run: ### Remove for all users -Or, if you have installed Compose for all users, run: +Or, if you have installed Docker Compose for all users, run: ```console $ rm /usr/local/lib/docker/cli-plugins/docker-compose @@ -48,15 +48,14 @@ Or, if you have installed Compose for all users, run: > [!NOTE] > -> If you get a **Permission denied** error using either of the above -> methods, you do not have the permissions allowing you to remove -> Docker Compose. To force the removal, prepend `sudo` to either of the above instructions and run it again. +> If you get a **Permission denied** error using either of the previous +> methods, you do not have the permissions needed to remove +> Docker Compose. To force the removal, prepend `sudo` to either of the previous instructions and run it again. ### Inspect the location of the Compose CLI plugin To check where Compose is installed, use: - ```console $ docker info --format '{{range .ClientInfo.Plugins}}{{if eq .Name "compose"}}{{.Path}}{{end}}{{end}}' ``` From c5f308543d6a6334f269fcd9e82735a9ae0a80af Mon Sep 17 00:00:00 2001 From: Lorena Rangel Date: Wed, 4 Dec 2024 14:27:39 +0100 Subject: [PATCH 5/7] Correct Kubernetes version (#21561) ## Description ## Related issues or tickets ## Reviews - [ ] Technical review - [ ] Editorial review - [ ] Product review --- content/manuals/desktop/release-notes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/manuals/desktop/release-notes.md b/content/manuals/desktop/release-notes.md index 1dfd38bdebcc..7d029ae60737 100644 --- a/content/manuals/desktop/release-notes.md +++ b/content/manuals/desktop/release-notes.md @@ -45,7 +45,7 @@ Take a look at the [Docker Public Roadmap](https://github.com/orgs/docker/projec - [Docker Buildx v0.18.0](https://github.com/docker/buildx/releases/tag/v0.18.0) - [Docker Compose v2.30.3](https://github.com/docker/compose/releases/tag/v2.30.3) -- [Kubernetes v1.30.2](https://github.com/kubernetes/kubernetes/releases/tag/v1.30.5) +- [Kubernetes v1.30.5](https://github.com/kubernetes/kubernetes/releases/tag/v1.30.5) - [NVIDIA Container Toolkit v1.17.0](https://github.com/NVIDIA/nvidia-container-toolkit/releases/tag/v1.17.0) - [Docker Scout CLI v1.15.0](https://github.com/docker/scout-cli/releases/tag/v1.15.0) - Docker Init v1.4.0 From 687632a996f4114b2a245bb0e44063cb969eeafb Mon Sep 17 00:00:00 2001 From: Sarah Sanders Date: Wed, 4 Dec 2024 14:31:24 -0800 Subject: [PATCH 6/7] ENGDOCS-2328 (#21495) ## Description - Instructions in https://docs.docker.com/subscription/core-subscription/downgrade/ guide used Docker Hub steps, with Docker Home link. Updated to Docker Hub steps. In the DCP updates, this will have a tabbed view for hub vs. Billing console steps ## Related issues or tickets [ENGDOCS-2328](https://docker.atlassian.net/browse/ENGDOCS-2328?atlOrigin=eyJpIjoiZDFmZjZjNWY4YzBmNDExMTlmMDlkYjA3ODg1ZmJjMDEiLCJwIjoiaiJ9) ## Reviews - [ ] Editorial review [ENGDOCS-2328]: https://docker.atlassian.net/browse/ENGDOCS-2328?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ --------- Co-authored-by: Allie Sadler <102604716+aevesdocker@users.noreply.github.com> --- content/manuals/subscription/core-subscription/downgrade.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/manuals/subscription/core-subscription/downgrade.md b/content/manuals/subscription/core-subscription/downgrade.md index f1c65b5fb55c..355a81feae4f 100644 --- a/content/manuals/subscription/core-subscription/downgrade.md +++ b/content/manuals/subscription/core-subscription/downgrade.md @@ -36,7 +36,7 @@ If you want to downgrade a Docker Business subscription and your organization us > >If you have a [sales-assisted Docker Business subscription](details.md#sales-assisted), contact your account manager to downgrade your subscription. -1. Sign in to [Docker Home](https://app.docker.com). +1. Sign in to [Docker Hub](https://hub.docker.com). 2. Select your **avatar** and from the drop-down menu select **Billing**. From 8cd992531d26321f3dcdbc15597175eaf96d75af Mon Sep 17 00:00:00 2001 From: David Karlsson <35727626+dvdksn@users.noreply.github.com> Date: Tue, 3 Dec 2024 15:38:32 +0100 Subject: [PATCH 7/7] guides: docker build github actions primer Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com> --- content/guides/gha.md | 255 ++++++++++++++++++ .../manuals/build/ci/github-actions/_index.md | 2 +- 2 files changed, 256 insertions(+), 1 deletion(-) create mode 100644 content/guides/gha.md diff --git a/content/guides/gha.md b/content/guides/gha.md new file mode 100644 index 000000000000..04e7d497e3f1 --- /dev/null +++ b/content/guides/gha.md @@ -0,0 +1,255 @@ +--- +title: Introduction to GitHub Actions with Docker +linkTitle: GitHub Actions and Docker +summary: | + Learn how to automate image build and push with GitHub Actions. +params: + tags: [devops] + time: 10 minutes +--- + +This guide provides an introduction to building CI pipelines using Docker and +GitHub Actions. You will learn how to use Docker's official GitHub Actions to +build your application as a Docker image and push it to Docker Hub. By the end +of the guide, you'll have a simple, functional GitHub Actions configuration for +Docker builds. Use it as-is, or extend it further to fit your needs. + +## Prerequisites + +If you want to follow along with the guide, ensure you have the following: + +- A Docker account. +- Familiarity with Dockerfiles. + +This guide assumes basic knowledge of Docker concepts but provides explanations +for using Docker in GitHub Actions workflows. + +## Get the sample app + +This guide is project-agnostic and assumes you have an application with a +Dockerfile. + +If you need a sample project to follow along, you can use [this sample +application](https://github.com/dvdksn/rpg-name-generator.git), which includes +a Dockerfile for building a containerized version of the app. Alternatively, +use your own GitHub project or create a new repository from the template. + +{{% dockerfile.inline %}} + +{{ $data := resources.GetRemote "https://raw.githubusercontent.com/dvdksn/rpg-name-generator/refs/heads/main/Dockerfile" }} + +```dockerfile {collapse=true} +{{ $data.Content }} +``` + +{{% /dockerfile.inline %}} + +## Configure your GitHub repository + +The workflow in this guide pushes the image you build to Docker Hub. To do +that, you must authenticate with your Docker credentials (username and access +token) as part of the GitHub Actions workflow. + +For instructions on how to create a Docker access token, see +[Create and manage access tokens](/manuals/security/for-developers/access-tokens.md). + +Once you have your Docker credentials ready, add the credentials to your GitHub +repository so you can use them in GitHub Actions: + +1. Open your repository's **Settings**. +2. Under **Security**, go to **Secrets and variables > Actions**. +3. Under **Secrets**, create a new repository secret named `DOCKER_PASSWORD`, + containing your Docker access token. +4. Next, under **Variables**, create a `DOCKER_USERNAME` repository variable + containing your Docker Hub username. + +## Set up your GitHub Actions workflow + +GitHub Actions workflows define a series of steps to automate tasks, such as +building and pushing Docker images, in response to triggers like commits or +pull requests. In this guide, the workflow focuses on automating Docker builds +and testing, ensuring your containerized application works correctly before +publishing it. + +Create a file named `docker-ci.yml` in the `.github/workflows/` directory of +your repository. Start with the basic workflow configuration: + +```yaml +name: Build and Push Docker Image + +on: + push: + branches: + - main + pull_request: +``` + +This configuration runs the workflow on pushes to the main branch and on pull +requests. By including both triggers, you can ensure that the image builds +correctly for a pull request before it's merged. + +## Extract metadata for tags and annotations + +For the first step in your workflow, use the `docker/metadata-action` to +generate metadata for your image. This action extracts information about your +Git repository, such as branch names and commit SHAs, and generates image +metadata such as tags and annotations. + +Add the following YAML to your workflow file: + +```yaml +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Extract Docker image metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ vars.DOCKER_USERNAME }}/my-image +``` + +These steps prepare metadata to tag and annotate your images during the build +and push process. + +- The **Checkout** step clones the Git repository. +- The **Extract Docker image metadata** step extracts Git metadata and + generates image tags and annotations for the Docker build. + +## Authenticate to your registry + +Before you build the image, authenticate to your registry to ensure that you +can push your built image to the registry. + +To authenticate with Docker Hub, add the following step to your workflow: + +```yaml + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ vars.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} +``` + +This step uses the Docker credentials [configured in the repository settings](#configure-your-github-repository). + +## Build and push the image + +Finally, build the final production image and push it to your registry. The +following configuration builds the image and pushes it directly to a registry. + +```yaml + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + annotations: ${{ steps.meta.outputs.annotations }} +``` + +In this configuration: + +- `push: ${{ github.event_name != 'pull_request' }}` ensures that images are + only pushed when the event is not a pull request. This way, the workflow + builds and tests images for pull requests but only pushes images for commits + to the main branch. +- `tags` and `annotations` use the outputs from the metadata action to apply + consistent tags and [annotations](/manuals/build/metadata/annotations.md) to + the image automatically. + +## Attestations + +SBOM (Software Bill of Materials) and provenance attestations improve security +and traceability, ensuring your images meet modern software supply chain +requirements. + +With a small amount of additional configuration, you can configure +`docker/build-push-action` to generate Software Bill of Materials (SBOM) and +provenance attestations for the image, at build-time. + +To generate this additional metadata, you need to make two changes to your +workflow: + +- Before the build step, add a step that uses `docker/setup-buildx-action`. + This action configures your Docker build client with additional capabilities + that the default client doesn't support. +- Then, update the **Build and push Docker image** step to also enable SBOM and + provenance attestations. + +Here's the updated snippet: + +```yaml + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + annotations: ${{ steps.meta.outputs.annotations }} + provenance: true + sbom: true +``` + +For more details about attestations, refer to +[the documentation](/manuals/build/metadata/attestations/_index.md). + +## Conclusion + +With all the steps outlined in the previous section, here's the full workflow +configuration: + +```yaml +name: Build and Push Docker Image + +on: + push: + branches: + - main + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Extract Docker image metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ vars.DOCKER_USERNAME }}/my-image + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ vars.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + annotations: ${{ steps.meta.outputs.annotations }} + provenance: true + sbom: true +``` + +This workflow implements best practices for building and pushing Docker images +using GitHub Actions. This configuration can be used as-is or extended with +additional features based on your project's needs, such as +[multi-platform](/manuals/build/building/multi-platform.md). + +### Further reading + +- Learn more about advanced configurations and examples in the [Docker Build GitHub Actions](/manuals/build/ci/github-actions/_index.md) section. +- For more complex build setups, you may want to consider [Bake](/manuals/build/bake/_index.md). (See also the [Mastering Buildx Bake guide](/guides/bake/index.md).) +- Learn about Docker's managed build service, designed for faster, multi-platform builds, see [Docker Build Cloud](/guides/docker-build-cloud/_index.md). diff --git a/content/manuals/build/ci/github-actions/_index.md b/content/manuals/build/ci/github-actions/_index.md index 783d387a0106..ddf7ac404460 100644 --- a/content/manuals/build/ci/github-actions/_index.md +++ b/content/manuals/build/ci/github-actions/_index.md @@ -1,5 +1,5 @@ --- -title: Introduction to GitHub Actions +title: Docker Build GitHub Actions linkTitle: GitHub Actions description: Docker maintains a set of official GitHub Actions for building Docker images. keywords: ci, github actions, gha, build, introduction, tutorial