I’m using docker/build-push-action and am trying to find a way to shorten the image name when it gets pushed to github registry.
Currently the docker image name is showing as
ghcr.io/organization-name/project-image:latest
Can this be shortened to just be the image name and tag without the ghcr.io/organization-name/
2
Answers
The name of a docker image tag needs to include a registry hostname when you use docker push (unless you are pushing to the default Docker’s public registry located at
registry-1.docker.io
)It is how
docker push
knows where to push to.That is why a typical "build and push" step looks like:
In your case, (using the
docker/build-push-action
), even if you were to use a local registry, you would still need to tag accordingly.Just specify in the
tags
argument, like: