Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 10

Overwrite Docker image in GitHub Package Registry

What is the proper way to overwrite a tagged Docker image in the GitHub Package Registry?

I've been updating my code consistently for the past hour, yet the image inside the registry (tagged as "latest") is still from two hours ago.

docker images -a

 

doesn't return the name of my image, so I cannot simply delete it before building the new image.

9 Replies
Ground Controller Lvl 1
Message 2 of 10

Re: Overwrite Docker image in GitHub Package Registry

Not working for me too. Looks like a bug.
Ground Controller Lvl 1
Message 3 of 10

Re: Overwrite Docker image in GitHub Package Registry

Same problem on our side. We also cannot pull the specific tag with the error message "tag not found"

Highlighted
Copilot Lvl 3
Message 4 of 10

Re: Overwrite Docker image in GitHub Package Registry

Still not working for me.
Pushing latest does not give an error, but tag is not updated.
Ground Controller Lvl 1
Message 5 of 10

Re: Overwrite Docker image in GitHub Package Registry

same issue for me. If I want to update a package I have to give it a new version tag. Interestingly enough, that new package (I consider it a new package since it has a different tag) is uploaded but the existing package (with the older version tag) disappears. Does this mean we also cannot have multiple versions of the same code / package like: app:latest, app:1.0, app:2.0

?

Copilot Lvl 2
Message 6 of 10

Re: Overwrite Docker image in GitHub Package Registry

It seems as though github package registry uses a different logic that the expected from a docker registry.

 

For a docker registry, like docker hub, when you upload an image with a tag that already exists, that tag is overwritten (like the default tag latest).

 

Github package registry instead seams to not allow any sort of rewrite, like npm, where you can't publish the same version twice.

 

This makes sense for npm packages, since that is how they work. But for docker it doesn't, since that not how docker images are usually pushed. It's common practice to have tags whose image gets changed constantly (like latest, or foo:4 which gets updated when foo:4.2 is uploaded)

Pilot Lvl 1
Message 7 of 10

Re: Overwrite Docker image in GitHub Package Registry

I think the elephant in the room is that overwriting would basically defeat the purpose of Github's no-deletion policy for public packages as defined here: 

https://help.github.com/en/github/managing-packages-with-github-package-registry/configuring-docker-...

 

Not sure if this is its own issue, but for us not being able to delete packages is a dealbreaker - basically it means that ownership and management is transfered to Github while we still are responsible for the public existance of artifacts, yet still Github dictates the process of deleting them.

 

As such I can not consider the package service that Github is offering and would hope Github reconsiders their stance, as laudable as the "idea" of having relieble packages sounds in theory.

Ground Controller Lvl 1
Message 8 of 10

Re: Overwrite Docker image in GitHub Package Registry

This looks to be the case, which is incredibly frustrating.

 

As much as they are for the dev community, I'm surprised that this is how they decided the docker repository to work. I really hope they will reconsider this decision.

Copilot Lvl 2
Message 9 of 10

Re: Overwrite Docker image in GitHub Package Registry

I have currently filled my quota with Docker images...so if I cannot delete them...then what?

Copilot Lvl 2
Message 10 of 10

Re: Overwrite Docker image in GitHub Package Registry

Any updates on this? We tag by container with semver & latest:

 

docker build -t docker.pkg.github.com/$GITHUB_REPOSITORY/container_name:${{ steps.get_version.outputs.VERSION }} -t docker.pkg.github.com/$GITHUB_REPOSITORY/container_name:latest .


Then push both tags:

docker push docker.pkg.github.com/$GITHUB_REPOSITORY/container_name:${{ steps.get_version.outputs.VERSION }}
docker push docker.pkg.github.com/$GITHUB_REPOSITORY/container_name:latest

We're using containrrr/watchtower  which polls the registry for the `:latest` tag. Since the `:latest` tag is never overwritten our container never gets swapped out.

If not then we'll need to write a custom webhook to ping from Actions...