3

I'm trying to setup a caching local registry for docker using official registry:latest Image. I want to make this container use organizations http proxy for internet access when trying to pull from docker hub.

any help would be appretiated.

P.S you can follow this guide to create a caching local registry.

Farhad Farahi
  • 231
  • 2
  • 8

1 Answers1

3

After hours of trying different stuff, answering my own question to help others.

sudo docker run -d -p 5000:5000 -v /home/myhomedirectory/test:/var/lib/registry -e http_proxy=http://organizationswebproxyaddress:port/ --name registry registry /var/lib/registry/config.yml

Look at -e switch with -e switch you can pass in environmental variables to the container. In this case im passing http_proxy environmental variable so the container uses my http proxy for accessing the Internet. you can even authenticate if your proxy needs authentication.

Farhad Farahi
  • 231
  • 2
  • 8
  • I assumed you had already done this from the line in your original question: "I already tried setting http_proxy inside the container with no luck." Including the commands you were running would have helped debug your problem faster. – BMitch Sep 19 '16 at 01:51
  • He deleted the line after you pointed it out :D – Morgan Christiansson Apr 25 '21 at 00:12