In order for Docker to communicate with Harbor and push/pull images, you need to add Harbor information to the Docker configuration. Specifically, you need to specify the address of Harbor in the configuration file of the Docker daemon, and restart the Docker service for the configuration to take effect.
Here are the steps to configure Docker integration with Harbor:
-
Open the Docker configuration file: Open the Docker configuration file with a text editor
daemon.json
. This file is usually located at/etc/docker/daemon.json
.sudo vim /etc/docker/daemon.json
If the file does not exist, a new one can be created.
-
Add the address of Harbor: Add the following content in the configuration file to specify the address of Harbor, and replace
harbor.example.com
with your Harbor hostname or IP address.{ "insecure-registries": ["harbor.example.com"] }
If your Harbor uses HTTPS, you need to
harbor.example.com
replace with Harbor's HTTPS address, and make sure the certificate is properly configured.If
"insecure-registries"
the key already exists in the configuration file, just add Harbor's address to the existing array. -
Save and Close File: Saves
daemon.json
changes to the file and closes the editor. -
Restart the Docker service: Run the following command to restart the Docker service for the configuration to take effect.
sudo systemctl restart docker
Now, Docker will be able to connect to Harbor and can push and pull images.
Please make sure Harbor is properly configured and you can access and log in to the Harbor repository before following the steps above.
Hope this helps you configure Docker integration with Harbor! If you have any other questions, please feel free to ask.