You can push images from Docker to a project on the embedded Harbor Registry. Projects in the embedded Harbor Registry correspond to vSphere namespaces on a Supervisor Cluster.

Prerequisites

In addition, obtain your user account for which you have write permissions on the namespace that corresponds to the project on Harbor Registry where you want to push images.

Lastly, you need a local image that you can push to the registry. The following command pulls the hello-world image from Docker Hub. You will need an account there to pull the image.
docker run hello-world
Expected result:
Hello from Docker!
This message shows that your installation appears to be working correctly.
Verify the image using the docker images command.
docker images
REPOSITORY     TAG                 IMAGE ID            CREATED             SIZE
hello-world    latest              bf756fb1ae65        10 months ago       13.3kB

Procedure

  1. Login to Harbor Registry with the vSphere Docker Credential Helper.
    docker-credential-vsphere login <container-registry-IP> --user [email protected]
    Note: While providing --user username is acceptable for login, you should use the UserPrincipalName (UPN) syntax ( --user [email protected]) to login and use docker push commands.
  2. Tag the image that you want to push to the project in Harbor Registry with same name as the namespace, where you want to use it:
    docker tag <image-name>[:TAG] <container-registry-IP>/<project-name>/<image-name>[:TAG]
    
    For example:
    docker tag hello-world:latest 10.179.145.77/tkgs-cluster-ns/hello-world:latest
    
    docker images
    REPOSITORY                                    TAG                 IMAGE ID            CREATED             SIZE
    10.179.145.77/tkgs-cluster-ns/hello-world     latest              bf756fb1ae65        10 months ago       13.3kB
    hello-world                                   latest              bf756fb1ae65        10 months ago       13.3kB
    
  3. To push an image to a project in Harbor, run the following command:
    Syntax:
    docker push <container-registry-IP>/<namespace-name>/<image_name>
    For example:
    docker push 10.179.145.77/tkgs-cluster-ns/hello-world:latest
    
    Expected result.
    The push refers to repository [10.179.145.77/tkgs-cluster-ns/hello-world]
    9c27e219663c: Pushed
    latest: digest: sha256:90659bf80b44ce6be8234e6ff90a1ac34acbeb826903b02cfa0da11c82cbc042 size: 525
    
  4. Verify that the image is now available in the embedded Harbor Registry.
    • Log In to the Embedded Harbor Registry Console
    • Click the project link at the Projects > Project Name.
    • Select the Repositories tab.
    • You should see the image that you pushed to the registry is present, in the form namespace/image-name, such as tkgs-cluster-ns/hello-world.
    • Select this image and you see the latest tag and other metadata.
  5. Navigate back to the Repositories tab.
  6. Select the Push Image Docker Command drop down menu. The commands to tag and push images to this repository are provided to you.

Example

Here is another example image push to the embedded Harbor Registry:
docker tag busybox:latest <container-registry-IP>/<namespace-name>/busybox:latest
docker push <container-registry-IP>/busybox/busybox:latest

What to do next

Deploy vSphere Pods by using images from the Harbor registry. See Deploy an Application to a vSphere Pod Using the Embedded Harbor Registry.