Ashok Kumar
Ashok Kumar

Reputation: 31

Unable to pull docker images from harbor through proxy if default_backend is not mentioned

I have a private docker harbour repository which is having docker images and helm charts. I don't want to expose my harbour repository directly. I want to pull docker images and helm charts via HA Proxy server. So here is the my haproxy configuration.

frontend ashok_registry
  bind 0.0.0.0:8080
  use_backend content-repo if { path_beg -i /repository }

  use_backend gcp-repo if { path_beg -i /mygcp-registry }
  
  use_backend harbor-repo if { path_beg -i /v2/myharbour-registry }

Docker pull command

docker pull localhost:8080/myharbour-registry/app-images/myimage:1.1.0
Error response from daemon: unauthorized: authorize header needed to send HEAD to repository: authorize header needed to send HEAD to repository

Here is my HA Proxy logs, based on url haproxy is redirect to harbor-repo backend. But getting above error.

Dec 15 11:06:07 ubuntu haproxy[24156]: 127.0.0.1:46896 [15/Dec/2022:11:06:07.006] ashok_registry ashok_registry/<NOSRV> -1/-1/-1/-1/0 503 221 - - SC-- 1/1/0/0/0 0/0 "GET /v2/ HTTP/1.1"
Dec 15 11:06:08 ubuntu haproxy[24156]: 127.0.0.1:46904 [15/Dec/2022:11:06:07.007] ashok_registry harbor-repo/harbor-repo 0/0/1021/369/1390 401 485 - - ---- 1/1/0/0/0 0/0 "HEAD /v2/myharbour-registry/app-images/myimage/manifests/1.1.0 HTTP/1.1"
Dec 15 11:06:09 ubuntu haproxy[24156]: 127.0.0.1:46912 [15/Dec/2022:11:06:08.399] ashok_registry harbor-repo/harbor-repo 0/0/621/278/899 401 637 - - ---- 1/1/0/0/0 0/0 "GET /v2/myharbour-registry/app-images/myimage/manifests/1.1.0 HTTP/1.1"

But Same pull command is working fine without any issue when we mention default_backend harbor-repo. What's wrong with my ha proxy configuration.

Upvotes: 1

Views: 829

Answers (0)

Related Questions