Docker Community Forums

Share and learn in the Docker community.

How to push image to private registry - An image does not exist locally with the tag: localhost:5000/xxxx

I have running private registry

sudo docker run -d -p 5000:5000 --restart always --name registry registry:2
sudo docker ps
CONTAINER ID   IMAGE        COMMAND                  CREATED      STATUS       PORTS                                       NAMES
1707fb042a43   registry:2   "/ /etc…"   4 days ago   Up 2 hours>5000/tcp, :::5000->5000/tcp   registry

I have image need to push to my private registry

sudo docker images
REPOSITORY                             TAG       IMAGE ID       CREATED         SIZE
coinbase                               latest    7bfb7cc3d51c   11 months ago   781MB

When I try to push my image to my private registry

sudo docker push localhost:5000/coinbase:latest

docker answer me:

The push refers to repository [localhost:5000/coinbase]
An image does not exist locally with the tag: localhost:5000/coinbase

Why? It looks as don’t understanding that localhost:5000 is URL of my private registry. Where is mistake?

You have to rename your image to contain the URI of the registry:

sudo docker tag coinbase:latest localhost:5000/coinbase:latest
sudo docker push localhost:5000/coinbase:latest
1 Like

It’s not really RE-naming it is creating an additional fully qualified name which includes the registry alias. Your original image name has an implicit registry alias. Thus, when you list images you will see both.

1 Like

Thanks for correcting my answer :slight_smile:

You are right of course. I was afraid of using the word “rename” because my commands did not do that. It is not like docker rename old_container new_container. Although it could be using a cli plugin like

#!/usr/bin/env bash

set -eu -o pipefail

if [[ "$1" == "docker-cli-plugin-metadata" ]]; then
  echo '{
    "Vendor":"Akos Takacs",
    "ShortDescription":"Rename images"
  exit 0


case "$1" in



    docker image tag $old_name $new_name
    docker image rm $old_name
docker magick renameimage coinbase:latest localhost:5000/coinbase:latest

Now the effect is similar to renaming.