Home Explore Blog Models CI



docker

content/manuals/build/ci/github-actions/copy-image-registries.md
317b21c8ae363fe345f80bda5357948504c10efb8555597c0000000300000627
---
title: Copy image between registries with GitHub Actions
linkTitle: Copy image between registries
description: Build multi-platform images and copy them between registries with GitHub Actions
keywords: ci, github actions, gha, buildkit, buildx, registry
---

[Multi-platform images](../../building/multi-platform.md) built using Buildx can
be copied from one registry to another using the [`buildx imagetools create` command](/reference/cli/docker/buildx/imagetools/create.md):

```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

      - name: Push image to GHCR
        run: |
          docker buildx imagetools create \
            --tag ghcr.io/user/app:latest \
            --tag ghcr.io/user/app:1.0.0 \
            user/app:latest
```

Chunks
561c2137 (1st chunk of `content/manuals/build/ci/github-actions/copy-image-registries.md`)
Title: Copying Multi-Platform Images Between Registries with GitHub Actions
Summary
This document explains how to copy multi-platform images built with Buildx from one registry to another using the `buildx imagetools create` command within a GitHub Actions workflow. The example workflow demonstrates logging into Docker Hub and GitHub Container Registry, setting up QEMU and Buildx, building and pushing the image to Docker Hub, and then copying the image to GitHub Container Registry.