diff --git a/content/actions/using-containerized-services/about-service-containers.md b/content/actions/using-containerized-services/about-service-containers.md index b39fdd190612..e168f5817f29 100644 --- a/content/actions/using-containerized-services/about-service-containers.md +++ b/content/actions/using-containerized-services/about-service-containers.md @@ -120,6 +120,36 @@ jobs: {% endraw %} +## Authenticating with image registries + +You can specify credentials for your service containers in case you need to authenticate with an image registry. This allows you to use images from private registries or to [increase your DockerHub rate limit](https://www.docker.com/increase-rate-limits/). + +Here’s an example of authenticating with Docker Hub and the {% data variables.product.prodname_dotcom %} {% data variables.product.prodname_container_registry %}: + +{% raw %} + +```yaml copy +jobs: + build: + services: + redis: + # Docker Hub image + image: redis + ports: + - 6379:6379 + credentials: + username: ${{ secrets.dockerhub_username }} + password: ${{ secrets.dockerhub_password }} + db: + # Private registry image + image: ghcr.io/octocat/testdb:latest + credentials: + username: ${{ github.repository_owner }} + password: ${{ secrets.ghcr_password }} +``` + +{% endraw %} + ## Further reading - "[AUTOTITLE](/actions/using-containerized-services/creating-redis-service-containers)"