During a recent engagement with a customer, I encountered some trouble while attempting to install VMware Harbor on a Photon OS Linux host behind their corporate proxy. I’ve installed Harbor several times before, however within this customer’s environment, I couldn’t seem to get around an error during the phase of the install which attempts to pull harbor from VMware’s public docker hub repository. The error I received was:
1 2 3 4 | [Step 3]: starting Harbor ... Pulling log (vmware/harbor-log:0.5.0)... Pulling repository docker.io/vmware/harbor-log ERROR: Network timed out while trying to connect to https://index.docker.io/v1/repositories/vmware/harbor-log/images. You may want to check your internet connection or if you are behind a proxy. |
I suspected it was proxy related, however not only did I have the customer’s proxy configured in Photon, but I was also able to curl ‘index.docker.io’ which confirmed my proxy information was recognized by Photon.
Next thing I checked was my DNS configuration in /etc/resolv.conf and on my network config in /etc/systemd/network/… however, my DNS server was confirmed to be correct in both locations.
Finally, I faced an RTFM moment and perused the docker guide online when I stumbled upon a section which provided a solution to the error. Apparently, in addition to the proxy configuration on the Linux host, HTTP proxy information must also be included in Docker’s configuration for systemd as well. Let’s walk through this simple resolution:
- First, edit the http-proxy file on your Photon host (create this file if it doesn’t already exist):
1 | root@myserver [ /opt/vmware/harbor ]# vim /etc/systemd/system/docker.service.d/http-proxy.conf |
2. Next, Edit the http-proxy.conf file to include your proxy server and port for the “HTTP_PROXY” environment variable:
1 2 3 | [Service] Environment="HTTP_PROXY=http://proxy.example.com:80/" |
3. Next, flush changes:
1 | systemctl daemon-reload |
4. At this step, perform a confirmation that the variable was applied:
1 2 | systemctl show --property=Environment docker Environment=HTTP_PROXY=http://proxy.example.com:80/ |
5. Finally, restart the docker service:
1 | systemctl restart docker |
You should now be able to install Harbor, and pull images from docker hub or any other public registry you try to access:
Hopefully this works for you too. =)
Hello! Cool post, amazing!!!