From 99edc31e03fef99df724797be83dbd97d587d950 Mon Sep 17 00:00:00 2001 From: Hossein Abbasi <16090309+hsnabszhdn@users.noreply.github.com> Date: Sat, 12 Oct 2024 07:44:49 +1100 Subject: [PATCH] Fix container<->host port mapping notes (#34907) --- .../using-containerized-services/about-service-containers.md | 4 ++-- .../writing-workflows/workflow-syntax-for-github-actions.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/content/actions/use-cases-and-examples/using-containerized-services/about-service-containers.md b/content/actions/use-cases-and-examples/using-containerized-services/about-service-containers.md index 3cfba7b219a1..2dc71ffec9f3 100644 --- a/content/actions/use-cases-and-examples/using-containerized-services/about-service-containers.md +++ b/content/actions/use-cases-and-examples/using-containerized-services/about-service-containers.md @@ -84,11 +84,11 @@ You can map service containers ports to the Docker host using the `ports` keywor |------------------|--------------| | `8080:80` | Maps TCP port 80 in the container to port 8080 on the Docker host. | | `8080:80/udp` | Maps UDP port 80 in the container to port 8080 on the Docker host. | -| `8080/udp` | Map a randomly chosen UDP port in the container to UDP port 8080 on the Docker host. | +| `8080/udp` | Maps a randomly chosen port on the Docker host to UDP port 8080 in the container. | When you map ports using the `ports` keyword, {% data variables.product.prodname_dotcom %} uses the `--publish` command to publish the container’s ports to the Docker host. For more information, see "[Docker container networking](https://docs.docker.com/config/containers/container-networking/)" in the Docker documentation. -When you specify the Docker host port but not the container port, the container port is randomly assigned to a free port. {% data variables.product.prodname_dotcom %} sets the assigned container port in the service container context. For example, for a `redis` service container, if you configured the Docker host port 5432, you can access the corresponding container port using the `job.services.redis.ports[5432]` context. For more information, see "[AUTOTITLE](/actions/learn-github-actions/contexts#job-context)." +When you specify the container port but not the Docker host port, the container port is randomly assigned to a free port. {% data variables.product.prodname_dotcom %} sets the assigned container port in the service container context. For example, for a `redis` service container, if you configured the Docker host port 5432, you can access the corresponding container port using the `job.services.redis.ports[5432]` context. For more information, see "[AUTOTITLE](/actions/learn-github-actions/contexts#job-context)." ### Example mapping Redis ports diff --git a/content/actions/writing-workflows/workflow-syntax-for-github-actions.md b/content/actions/writing-workflows/workflow-syntax-for-github-actions.md index d3c77feb77ed..a97e4415e6d5 100644 --- a/content/actions/writing-workflows/workflow-syntax-for-github-actions.md +++ b/content/actions/writing-workflows/workflow-syntax-for-github-actions.md @@ -1002,7 +1002,7 @@ For more information about the differences between networking service containers ### Example: Using localhost -This example creates two services: nginx and redis. When you specify the container port but not the host port, the host port is randomly assigned to a free port on host. {% data variables.product.prodname_dotcom %} sets the assigned host port in the {% raw %}`${{job.services..ports}}`{% endraw %} context. In this example, you can access the service host ports using the {% raw %}`${{ job.services.nginx.ports['80'] }}`{% endraw %} and {% raw %}`${{ job.services.redis.ports['6379'] }}`{% endraw %} contexts. +This example creates two services: nginx and redis. When you specify the container port but not the host port, the container port is randomly assigned to a free port on the host. {% data variables.product.prodname_dotcom %} sets the assigned host port in the {% raw %}`${{job.services..ports}}`{% endraw %} context. In this example, you can access the service host ports using the {% raw %}`${{ job.services.nginx.ports['80'] }}`{% endraw %} and {% raw %}`${{ job.services.redis.ports['6379'] }}`{% endraw %} contexts. ```yaml services: