If you’re working with containerized applications, chances are you’ve come across Harbor—a powerful, enterprise-grade container registry. Whether you’re migrating images or integrating Harbor into your CI/CD pipeline, knowing how to push a local image tarball to Harbor is essential.
In this article, we’ll walk through how to load and push the nginx-amd64.tar
image to a Harbor registry hosted at habor1.test.com
.
Prerequisites
Before we begin, make sure you have:
- Docker installed and running
- Access to the Harbor registry (
habor1.test.com
) - A project created in Harbor (we’ll use
demo
in this example) - The image tarball:
nginx-amd64.tar
Step 1: Load the Image from Tarball
Start by loading the image into your local Docker registry:
docker load -i nginx-amd64.tar
You should see output like:
Loaded image: nginx:latest
Step 1.5: Inspect the Loaded Image
To confirm the image was loaded and check its tag, run:
docker images
This will list all available images. Look for the nginx
image and note its TAG
and IMAGE ID
. If the image shows <none>
for repository or tag, use the IMAGE ID
to tag it manually.
Example output:
REPOSITORY TAG IMAGE ID CREATED SIZE
<none> <none> abc123def456 2 hours ago 133MB
Step 1.6: Tag the Image for Harbor
Docker requires the image to be tagged with the registry address and project path. Use the IMAGE ID
from the previous step:
docker tag abc123def456 habor1.test.com/demo/nginx:latest
This tells Docker:
abc123def456
: the image ID of the loaded imagehabor1.test.com/demo/nginx:latest
: the full path to the Harbor repository, including project (demo
), image name (nginx
), and tag (latest
)
Step 2: Log in to Harbor
Authenticate with your Harbor registry:
docker login habor1.test.com
Enter your username and password when prompted. If Harbor uses a self-signed certificate, make sure Docker trusts it by placing the CA cert in:
/etc/docker/certs.d/habor1.test.com/ca.crt
Then restart Docker:
systemctl restart docker
Step 3: Push the Image to Harbor
Now push the image to your Harbor registry:
docker push habor1.test.com/demo/nginx:latest
If everything is configured correctly, Docker will upload the image layers and register it under the demo
project in Harbor.
Step 4: Verify in Harbor UI
Log into the Harbor web interface at https://habor1.test.com
, navigate to the demo
project, and confirm that the nginx
image appears with the latest
tag.