Use the vSphere Docker Credential Helper CLI to securely push container images to and pull container images from the embedded Harbor Registry.

Use the vSphere Docker Credential Helper to securely connect your Docker client to a container registry.
Note: The vSphere Docker Credential Helper is intended to be used with the embedded Harbor Registry, which is deprecated. If you are using the Harbor Supervisor Service, see the following topic to connect to it using Docker: Configure a Docker Client with the Harbor Registry Certificate.

Prerequisites

The Kubernetes CLI Tools download page includes a link to download the vSphere Docker Credential Helper.
  • Configure a Docker client.
  • Obtain access to the embedded Harbor Registry enabled on Supervisor.
  • Get the link to the Kubernetes CLI Tools for vSphere download page from your vSphere administrator.
  • Alternatively, if you have access to the vCenter Server, get the link as follows:
    • Log in to the vCenter Server using the vSphere Client.
    • Navigate to Workload Management > Namespaces and select the target vSphere Namespace.
    • Select the Summary tab and locate the Status tile.
    • Select Open beneath the Link to CLI Tools heading to open the download page. Or, you can Copy the link.

Procedure

  1. Using a browser, navigate to the Kubernetes CLI Tools download URL for your environment.
  2. Scroll down to the vSphere Docker Credential Helper section.
  3. Select the operating system.
  4. Download the vsphere-docker-credential-helper.zip file.
  5. Extract the contents of the ZIP file to a working directory.
    The docker-credential-vsphere binary executable is available.
  6. Copy the docker-credential-vsphere binary to your Docker client host.
  7. Add the location of the binary to your system PATH.
    For example, on Linux:
    mv docker-credential-vsphere /usr/local/bin/docker-credential-vsphere
  8. Verify the installation of the vSphere Docker Credential Helper by running the command docker-credential-vsphere in a shell or terminal session.
    You see the banner message, and the list of command-line options for the CLI.
    vSphere login manager is responsible for vSphere authentication. 
    It allows vSphere users to securely login and logout to access Harbor images.
    
    Usage:
      docker-credential-vsphere [command]
    
    Available Commands:
      help        Help about any command
      login       Login into specific harbor server and get authentication
      logout      Logout from Harbor server and erase user token
    
    Flags:
      -h, --help   help for docker-credential-vsphere
    
    Use "docker-credential-vsphere [command] --help" for more information about a command.
    
  9. Log in to a Registry.
    First, check the usage:
    docker-credential-vsphere login -help
    Usage:
      docker-credential-vsphere login [harbor-registry] [flags]
    
    Flags:
      -h, --help               help for login
      -s, --service string     credential store service
          --tlscacert string   location to CA certificate (default "/etc/docker/certs.d/*.crt")
      -u, --user string        vSphere username and password
    
    Note: The vSphere Docker Credential Helper expects the user string to be all lower case characters. If you do not use all lower case characters, the log in may work but subsequent Docker commands may not. Make sure you use all lower case characters for the user name.
    Then, log in using the following command:
    docker-credential-vsphere login <container-registry-IP>
    The authentication token is fetched and saved, and you are logged in.
    docker-credential-vsphere login 10.179.145.77
    Username: [email protected]
    Password: INFO[0017] Fetched username and password
    INFO[0017] Fetched auth token
    INFO[0017] Saved auth token
    
  10. Log out of the Harbor Registry.
    docker-credential-vsphere logout 10.179.145.77