Skip to content

Commit 105bf59

Browse files
committed
docs: copy between registries with buildx
Signed-off-by: CrazyMax <[email protected]>
1 parent 48888e0 commit 105bf59

File tree

1 file changed

+14
-29
lines changed

1 file changed

+14
-29
lines changed
Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
# Copy images between registries
22

3-
Multi-platform images built using buildx can be copied from one registry to another without
4-
changing the image SHA using the [tag-push-action](https://github.com/akhilerm/tag-push-action).
5-
6-
The following workflow will first push the image to dockerhub, run some tests using the images
7-
and then push to quay and ghcr
3+
[Multi-platform images](https://docs.docker.com/build/building/multi-platform/)
4+
built using Buildx can be copied from one registry to another using the
5+
[`imagetools create` command](https://docs.docker.com/engine/reference/commandline/buildx_imagetools_create/):
86

97
```yaml
108
name: ci
@@ -27,26 +25,19 @@ jobs:
2725
-
2826
name: Set up Docker Buildx
2927
uses: docker/setup-buildx-action@v2
30-
- # quay and ghcr logins for pushing image after testing
31-
name: Login to Quay Registry
28+
-
29+
name: Login to Docker Hub
3230
uses: docker/login-action@v2
3331
with:
34-
registry: quay.io
35-
username: ${{ secrets.QUAY_USERNAME }}
36-
password: ${{ secrets.QUAY_TOKEN }}
32+
username: ${{ secrets.DOCKERHUB_USERNAME }}
33+
password: ${{ secrets.DOCKERHUB_TOKEN }}
3734
-
3835
name: Login to GitHub Container Registry
3936
uses: docker/login-action@v2
4037
with:
4138
registry: ghcr.io
4239
username: ${{ github.repository_owner }}
4340
password: ${{ secrets.GITHUB_TOKEN }}
44-
-
45-
name: Login to DockerHub
46-
uses: docker/login-action@v2
47-
with:
48-
username: ${{ secrets.DOCKERHUB_USERNAME }}
49-
password: ${{ secrets.DOCKERHUB_TOKEN }}
5041
-
5142
name: Build and push
5243
uses: docker/build-push-action@v3
@@ -57,17 +48,11 @@ jobs:
5748
tags: |
5849
user/app:latest
5950
user/app:1.0.0
60-
- # run tests using image from docker hub
61-
name: Run Tests
62-
run: make tests
63-
- # copy multiplatform image from dockerhub to quay and ghcr
64-
name: Push Image to multiple registries
65-
uses: akhilerm/[email protected]
66-
with:
67-
src: docker.io/user/app:1.0.0
68-
dst: |
69-
quay.io/user/app:latest
70-
quay.io/user/app:1.0.0
71-
ghcr.io/user/app:latest
72-
ghcr.io/user/app:1.0.0
51+
-
52+
name: Push image to GHCR
53+
run: |
54+
docker buildx imagetools create \
55+
--tag ghcr.io/user/app:latest \
56+
--tag ghcr.io/user/app:1.0.0 \
57+
user/app:latest
7358
```

0 commit comments

Comments
 (0)