Home Explore Blog Models CI



docker

content/manuals/build/ci/github-actions/push-multi-registries.md
02bbbb0a1a31b9cd54936fd13ca6847c3eaea1e82f27648c0000000300000514
---
title: Push to multiple registries with GitHub Actions
linkTitle: Push to multiple registries
description: Push to multiple registries with GitHub Actions
keywords: ci, github actions, gha, buildkit, buildx, registry
---

The following workflow will connect you to Docker Hub and GitHub Container
Registry, and push the image to both registries:

```yaml
name: ci

on:
  push:

jobs:
  docker:
    runs-on: ubuntu-latest
    steps:
      - name: Login to Docker Hub
        uses: docker/login-action@v3
        with:
          username: ${{ vars.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}

      - name: Login to GitHub Container Registry
        uses: docker/login-action@v3
        with:
          registry: ghcr.io
          username: ${{ github.repository_owner }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Set up QEMU
        uses: docker/setup-qemu-action@v3

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3

      - name: Build and push
        uses: docker/build-push-action@v6
        with:
          platforms: linux/amd64,linux/arm64
          push: true
          tags: |
            user/app:latest
            user/app:1.0.0
            ghcr.io/user/app:latest
            ghcr.io/user/app:1.0.0
```

Chunks
4768df58 (1st chunk of `content/manuals/build/ci/github-actions/push-multi-registries.md`)
Title: GitHub Actions Workflow for Pushing Images to Multiple Registries
Summary
This document provides a GitHub Actions workflow example that demonstrates how to build and push Docker images to both Docker Hub and GitHub Container Registry. The workflow includes steps for logging into both registries, setting up QEMU and Docker Buildx, and then building and pushing the images for multiple platforms with specified tags.