Downloading images from Harbor
In the following example, replace
URLregistry with the URL shown on the Container Registry
details page.
- Access Harbor and identify the full path of the image, for example:
URLregistry/project/image:tag
- log in to the registry using your credentials:
docker login URLregistry
or, if you are using containerd:
crictl login URLregistry
- download the required image:
docker pull URLregistry/project/image:tag
or:
ctr images pull URLregistry/project/image:tag
- verify that the image has been downloaded:
docker images
- if the registry uses an unrecognized certificate or an HTTP connection, add the CA certificate to the Docker client or configure the registry as an insecure registry.
Uploading images to Harbor
In the following example, replace
URLoldregistry and
URLnewregistry with the URLs shown on the respective Container Registry
details pages.
- Log in to the new Harbor registry:
docker login URLnewregistry
- retag the local image to point to the new registry:
docker tag URLoldregistry/project/image:tag URLnewregistry/newproject/image:tag
- upload the image to the new registry:
docker push URLnewregistry/newproject/image:tag
- verify the upload using the Harbor interface or with:
docker pull URLnewregistry/newproject/image:tag
- if you are using Kubernetes, to allow pods to download images from a private Harbor project, create a Docker Registry Secret and reference it in your manifests:
kubectl create secret docker-registry harbor-cred \ --docker-server=URLnewregistry \ --docker-username=<username> \ --docker-password=<password> \ --docker-email=<email> # Example in a Deployment spec: imagePullSecrets: - name: harbor-cred containers: - name: myapp image: URLnewregistry/newproject/image:tag