Search code examples
dockerdocker-registry

How to push a docker image to a private repository


I have a docker image tagged as me/my-image, and I have a private repo on the dockerhub named me-private.
When I push my me/my-image, I end up always hitting the public repo.

What is the exact syntax to specifically push my image to my private repo?


Solution

  • You need to tag your image correctly first with your registryhost:

    docker tag [OPTIONS] IMAGE[:TAG] [REGISTRYHOST/][USERNAME/]NAME[:TAG]
    

    Then docker push using that same tag.

    docker push NAME[:TAG]
    

    Example:

    docker tag 518a41981a6a myRegistry.com/myImage
    docker push myRegistry.com/myImage