Tag an image and push it to a registry

Medium risk
What do risk levels mean?
Read-only
Inspects state without changing anything.
Low risk
Reversible with a routine follow-up command.
Medium risk
Changes state; undo path documented.
Destructive
Deletes or overwrites; confirmation required.

Applies a registry-qualified tag to a local image and uploads it, making the image available to other machines and deploy environments.

dockerpushregistrytagimage

Parameters

Local image to publish, such as myapp:dev.

Registry-qualified name and tag to push, such as ghcr.io/acme/myapp:1.2.0.

Commands

Confirm the local image exists before tagging it

docker image ls <source_image>

Add the registry-qualified name to the local image

docker tag <source_image> <target_image>

Upload the image layers to the registry, publishing the tag

docker push <target_image>

Verification

docker manifest inspect <target_image>

The registry returns a manifest for the pushed tag, confirming it is published.

Undo

Not undoable

The local extra tag can be removed with docker rmi, but deleting the pushed tag from the registry requires registry-specific tooling or UI, and consumers may already have pulled it.

Pitfalls

  • Requires docker login to the target registry first; push fails with "denied" otherwise. Never embed credentials in the command.
  • Pushing to an existing tag overwrites it for future pulls; prefer immutable version tags over reusing latest.
  • Image architecture must match consumers; images built on Apple Silicon are arm64 by default and may not run on amd64 servers without a multi-platform build.

Related