Skip to content

Commit

Permalink
update readme and add check if images already exist
Browse files Browse the repository at this point in the history
  • Loading branch information
M-Kusumgar committed Jan 21, 2025
1 parent faa6dad commit e59a1d9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Docker Official Images

We are moving away from Docker Hub to GitHub Container Registry because of rate limiting issues. There may be certain images however, that officially available on Docker Hub so this is a small script to port those images to GHCR. You can then pull them using:
We are moving away from Docker Hub to GitHub Container Registry because of rate limiting issues.

There may be certain images however, that are officially available on Docker Hub so this is a small script to port those images to GHCR. You can add more images [here](./port-images-to-ghcr).

You can then pull them using:
```bash
docker pull ghcr.io/mrc-ide/docker-official-images/<image-name>:<tag>
```
14 changes: 11 additions & 3 deletions port-images-to-ghcr
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
#!/usr/bin/env bash
set -ex

# add more images here
declare -a docker_images=(
"redis:6"
"redis:5"
)

for image in "${docker_images[@]}"
do
docker pull "$image"
docker image tag "$image" ghcr.io/mrc-ide/docker-official-images/"$image"
docker image push ghcr.io/mrc-ide/docker-official-images/"$image"
docker manifest inspect ghcr.io/mrc-ide/docker-official-images/"$image" > /dev/null 2>&1
exit_code=$?

if [ $exit_code -eq 0 ]; then
echo "Not porting over $image because it already exists in the GHCR"
else
docker pull "$image"
docker image tag "$image" ghcr.io/mrc-ide/docker-official-images/"$image"
docker image push ghcr.io/mrc-ide/docker-official-images/"$image"
fi
done

0 comments on commit e59a1d9

Please sign in to comment.