diff --git a/cloud/ecs-integration.md b/cloud/ecs-integration.md index d31479de79..397370cad1 100644 --- a/cloud/ecs-integration.md +++ b/cloud/ecs-integration.md @@ -251,6 +251,10 @@ Services are registered automatically by the Docker Compose CLI on [AWS Cloud Ma Services can retrieve their dependencies using Compose service names (as they do when deploying locally with docker-compose), or optionally use the fully qualified names. +> **Note** +> +> Short service names, nor the fully qualified service names, will resolve unless you enable public dns names in your VPC. + ### Dependent service startup time and DNS resolution Services get concurrently scheduled on ECS when a Compose file is deployed. AWS Cloud Map introduces an initial delay for DNS service to be able to resolve your services domain names. Your code needs to support this delay by waiting for dependent services to be ready, or by adding a wait-script as the entrypoint to your Docker image, as documented in [Control startup order](../compose/startup-order.md). diff --git a/compose/extends.md b/compose/extends.md index 2e5677dc6a..462453c97e 100644 --- a/compose/extends.md +++ b/compose/extends.md @@ -179,7 +179,8 @@ $ docker-compose -f docker-compose.yml -f docker-compose.admin.yml \ > of keys added and removed, along with information on [how to upgrade](compose-file/compose-versioning.md#upgrading). > See [moby/moby#31101](https://github.com/moby/moby/issues/31101) to follow the > discussion thread on the possibility of adding support for `extends` in some form in -> future versions. +> future versions. The `extends` keyword has been included in docker-compose versions 1.27 +> and higher. Docker Compose's `extends` keyword enables the sharing of common configurations among different files, or even different projects entirely. Extending services diff --git a/config/containers/start-containers-automatically.md b/config/containers/start-containers-automatically.md index b73c66c7c8..7696d3b0f4 100644 --- a/config/containers/start-containers-automatically.md +++ b/config/containers/start-containers-automatically.md @@ -27,7 +27,7 @@ any of the following: | Flag | Description | |:-----------------|:------------------------------------------------------------------------------------------------| | `no` | Do not automatically restart the container. (the default) | -| `on-failure` | Restart the container if it exits due to an error, which manifests as a non-zero exit code. | +| `on-failure[:max-retries]` | Restart the container if it exits due to an error, which manifests as a non-zero exit code. Optionally, limit the number of times the Docker daemon attempts to restart the container using the `:max-retries` option. | | `always` | Always restart the container if it stops. If it is manually stopped, it is restarted only when Docker daemon restarts or the container itself is manually restarted. (See the second bullet listed in [restart policy details](#restart-policy-details)) | | `unless-stopped` | Similar to `always`, except that when the container is stopped (manually or otherwise), it is not restarted even after Docker daemon restarts. | diff --git a/desktop/mac/release-notes/index.md b/desktop/mac/release-notes/index.md index 32b60a2f1d..686bad1537 100644 --- a/desktop/mac/release-notes/index.md +++ b/desktop/mac/release-notes/index.md @@ -37,7 +37,7 @@ This page contains information about the new features, improvements, known issue - [containerd v1.4.11](https://github.com/containerd/containerd/releases/tag/v1.4.11) - [runc v1.0.2](https://github.com/opencontainers/runc/releases/tag/v1.0.2) - [Go 1.17.2](https://golang.org/doc/go1.17) -- [Compose CLI v2.1.1](https://github.com/docker/compose/releases/tag/v2.1.1) +- [Compose v2.1.1](https://github.com/docker/compose/releases/tag/v2.1.1) - [docker-scan 0.9.0](https://github.com/docker/scan-cli-plugin/releases/tag/v0.9.0) ### Bug fixes and minor changes diff --git a/desktop/windows/release-notes/index.md b/desktop/windows/release-notes/index.md index 64bff51813..f2655b4d98 100644 --- a/desktop/windows/release-notes/index.md +++ b/desktop/windows/release-notes/index.md @@ -36,7 +36,7 @@ This page contains information about the new features, improvements, known issue - [containerd v1.4.11](https://github.com/containerd/containerd/releases/tag/v1.4.11) - [runc v1.0.2](https://github.com/opencontainers/runc/releases/tag/v1.0.2) - [Go 1.17.2](https://golang.org/doc/go1.17) -- [Compose CLI v2.1.1](https://github.com/docker/compose/releases/tag/v2.1.1) +- [Compose v2.1.1](https://github.com/docker/compose/releases/tag/v2.1.1) - [docker-scan 0.9.0](https://github.com/docker/scan-cli-plugin/releases/tag/v0.9.0) ### Bug fixes and minor changes diff --git a/engine/api/sdk/examples.md b/engine/api/sdk/examples.md index 7ba19bc74d..40812c6ea7 100644 --- a/engine/api/sdk/examples.md +++ b/engine/api/sdk/examples.md @@ -62,6 +62,8 @@ func main() { if err != nil { panic(err) } + + defer reader.Close() io.Copy(os.Stdout, reader) resp, err := cli.ContainerCreate(ctx, &container.Config{ @@ -182,6 +184,7 @@ func main() { if err != nil { panic(err) } + defer out.Close() io.Copy(os.Stdout, out) resp, err := cli.ContainerCreate(ctx, &container.Config{ diff --git a/engine/install/debian.md b/engine/install/debian.md index 8049ba81f8..1388d17e3b 100644 --- a/engine/install/debian.md +++ b/engine/install/debian.md @@ -124,6 +124,12 @@ This procedure works for Debian on `x86_64` / `amd64`, `armhf`, `arm64`, and Ras > `apt-get update` command always installs the highest possible version, > which may not be appropriate for your stability needs. + > Receiving a GPG error when running `apt-get update`? + > + > Your default umask may not be set correctly, causing the public key file + > for the repo to not be detected. Run the following command and then try to + > update your repo again: `sudo chmod a+r /usr/share/keyrings/docker-archive-keyring.gpg`. + 2. To install a _specific version_ of Docker Engine, list the available versions in the repo, then select and install: diff --git a/get-started/07_multi_container.md b/get-started/07_multi_container.md index b255026550..4cc4c6b9a0 100644 --- a/get-started/07_multi_container.md +++ b/get-started/07_multi_container.md @@ -178,7 +178,12 @@ The todo app supports the setting of a few environment variables to specify MySQ With all of that explained, let's start our dev-ready container! -1. We'll specify each of the environment variables above, as well as connect the container to our app network. +1. **Note**: for MySQL versions 8.0 and higher, make sure to include the following commands in `mysql`. + ```console + mysql> ALTER USER 'root' IDENTIFIED WITH mysql_native_password BY 'secret'; + mysql> flush privileges; + ``` +2. We'll specify each of the environment variables above, as well as connect the container to our app network. ```console $ docker run -dp 3000:3000 \ @@ -205,8 +210,7 @@ With all of that explained, let's start our dev-ready container! node:12-alpine ` sh -c "yarn install && yarn run dev" ``` - -2. If we look at the logs for the container (`docker logs `), we should see a message indicating it's +3. If we look at the logs for the container (`docker logs `), we should see a message indicating it's using the mysql database. ```console @@ -219,9 +223,9 @@ With all of that explained, let's start our dev-ready container! Listening on port 3000 ``` -3. Open the app in your browser and add a few items to your todo list. +4. Open the app in your browser and add a few items to your todo list. -4. Connect to the mysql database and prove that the items are being written to the database. Remember, the password +5. Connect to the mysql database and prove that the items are being written to the database. Remember, the password is **secret**. ```console diff --git a/get-started/kube-deploy.md b/get-started/kube-deploy.md index b114c5ed7d..1a3338440a 100644 --- a/get-started/kube-deploy.md +++ b/get-started/kube-deploy.md @@ -63,7 +63,7 @@ All containers in Kubernetes are scheduled as _pods_, which are groups of co-loc In this Kubernetes YAML file, we have two objects, separated by the `---`: - A `Deployment`, describing a scalable group of identical pods. In this case, you'll get just one `replica`, or copy of your pod, and that pod (which is described under the `template:` key) has just one container in it, based off of your `bulletinboard:1.0` image from the previous step in this tutorial. - - A `NodePort` service, which will route traffic from port 30001 on your host to port 8080 inside the pods it routes to, allowing you to reach your bulletin board from the network. + - A `NodePort` service, which will route traffic from port 30001 on your host to port 3000 inside the pods it routes to, allowing you to reach your bulletin board from the network. Also, notice that while Kubernetes YAML can appear long and complicated at first, it almost always follows the same pattern: - The `apiVersion`, which indicates the Kubernetes API that parses this object @@ -105,7 +105,7 @@ All containers in Kubernetes are scheduled as _pods_, which are groups of co-loc $ kubectl get services NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE - bb-entrypoint NodePort 10.106.145.116 8080:30001/TCP 53s + bb-entrypoint NodePort 10.106.145.116 3000:30001/TCP 53s kubernetes ClusterIP 10.96.0.1 443/TCP 138d ``` diff --git a/language/java/configure-ci-cd.md b/language/java/configure-ci-cd.md index 46874eabfc..2871db67e6 100644 --- a/language/java/configure-ci-cd.md +++ b/language/java/configure-ci-cd.md @@ -211,11 +211,16 @@ Next, change your Docker Hub login to a GitHub container registry login: uses: docker/login-action@v1 with: registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GHCR_TOKEN }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} ``` {% endraw %} +To authenticate against the [GitHub Container Registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry), use the [`GITHUB_TOKEN`](https://docs.github.com/en/actions/reference/authentication-in-a-workflow) for the best security and experience. + +You may need to [manage write and read access of GitHub Actions](https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-ghcrio) for repositories in the container settings. + +You can also use a [personal access token (PAT)](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) with the [appropriate scopes](https://docs.github.com/en/packages/getting-started-with-github-container-registry/migrating-to-github-container-registry-for-docker-images#authenticating-with-the-container-registry). Remember to change how the image is tagged. The following example keeps ‘latest’ as the only tag. However, you can add any logic to this if you prefer: {% raw %} diff --git a/language/nodejs/configure-ci-cd.md b/language/nodejs/configure-ci-cd.md index 9ce738c7cc..7584791084 100644 --- a/language/nodejs/configure-ci-cd.md +++ b/language/nodejs/configure-ci-cd.md @@ -210,11 +210,16 @@ Next, change your Docker Hub login to a GitHub container registry login: uses: docker/login-action@v1 with: registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GHCR_TOKEN }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} ``` {% endraw %} +To authenticate against the [GitHub Container Registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry), use the [`GITHUB_TOKEN`](https://docs.github.com/en/actions/reference/authentication-in-a-workflow) for the best security and experience. + +You may need to [manage write and read access of GitHub Actions](https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-ghcrio) for repositories in the container settings. + +You can also use a [personal access token (PAT)](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) with the [appropriate scopes](https://docs.github.com/en/packages/getting-started-with-github-container-registry/migrating-to-github-container-registry-for-docker-images#authenticating-with-the-container-registry). Remember to change how the image is tagged. The following example keeps ‘latest’ as the only tag. However, you can add any logic to this if you prefer: {% raw %} diff --git a/language/python/configure-ci-cd.md b/language/python/configure-ci-cd.md index 1afc9f005a..98ee61a5cd 100644 --- a/language/python/configure-ci-cd.md +++ b/language/python/configure-ci-cd.md @@ -210,11 +210,16 @@ Next, change your Docker Hub login to a GitHub container registry login: uses: docker/login-action@v1 with: registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GHCR_TOKEN }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} ``` {% endraw %} +To authenticate against the [GitHub Container Registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry), use the [`GITHUB_TOKEN`](https://docs.github.com/en/actions/reference/authentication-in-a-workflow) for the best security and experience. + +You may need to [manage write and read access of GitHub Actions](https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-ghcrio) for repositories in the container settings. + +You can also use a [personal access token (PAT)](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) with the [appropriate scopes](https://docs.github.com/en/packages/getting-started-with-github-container-registry/migrating-to-github-container-registry-for-docker-images#authenticating-with-the-container-registry). Remember to change how the image is tagged. The following example keeps ‘latest’ as the only tag. However, you can add any logic to this if you prefer: {% raw %} diff --git a/samples/django.md b/samples/django.md index bc260b9a86..affb33805c 100644 --- a/samples/django.md +++ b/samples/django.md @@ -30,6 +30,7 @@ and a `docker-compose.yml` file. (You can use either a `.yml` or `.yaml` extensi ```dockerfile # syntax=docker/dockerfile:1 FROM python:3 + ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 WORKDIR /code COPY requirements.txt /code/ @@ -50,7 +51,7 @@ and a `docker-compose.yml` file. (You can use either a `.yml` or `.yaml` extensi 6. Add the required software in the file. Django>=3.0,<4.0 - psycopg2-binary>=2.8 + psycopg2>=2.8 7. Save and close the `requirements.txt` file. @@ -74,10 +75,6 @@ and a `docker-compose.yml` file. (You can use either a `.yml` or `.yaml` extensi image: postgres volumes: - ./data/db:/var/lib/postgresql/data - environment: - - POSTGRES_DB=postgres - - POSTGRES_USER=postgres - - POSTGRES_PASSWORD=postgres web: build: . command: python manage.py runserver 0.0.0.0:8000 @@ -85,6 +82,10 @@ and a `docker-compose.yml` file. (You can use either a `.yml` or `.yaml` extensi - .:/code ports: - "8000:8000" + environment: + - POSTGRES_NAME=postgres + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres depends_on: - db ``` @@ -169,12 +170,16 @@ In this section, you set up the database connection for Django. ```python # settings.py + import os + + [...] + DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', - 'NAME': 'postgres', - 'USER': 'postgres', - 'PASSWORD': 'postgres', + 'NAME': os.environ.get('POSTGRES_NAME'), + 'USER': os.environ.get('POSTGRES_USER'), + 'PASSWORD': os.environ.get('POSTGRES_PASSWORD'), 'HOST': 'db', 'PORT': 5432, } diff --git a/samples/dotnetcore.md b/samples/dotnetcore.md index ae398b8491..8ea87c541d 100644 --- a/samples/dotnetcore.md +++ b/samples/dotnetcore.md @@ -47,7 +47,7 @@ clone our [ASP.NET Docker Sample](https://github.com/dotnet/dotnet-docker/tree/m ```dockerfile # syntax=docker/dockerfile:1 -FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build-env +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env WORKDIR /app # Copy csproj and restore as distinct layers @@ -59,7 +59,7 @@ COPY ../engine/examples ./ RUN dotnet publish -c Release -o out # Build runtime image -FROM mcr.microsoft.com/dotnet/aspnet:3.1 +FROM mcr.microsoft.com/dotnet/aspnet:6.0 WORKDIR /app COPY --from=build-env /app/out . ENTRYPOINT ["dotnet", "aspnetapp.dll"]