1

I am behind a corporate proxy. I have HTTP_PROXY, HTTPS_PROXY, and NO_PROXY set in the image. When I'm connected to the network I have access to a private npm registry that is on this intranet. My docker image is unable to access this registry.

On the host machine, a mac, I can run:

curl https://<registry>/nodejs/content/groups/npm/lodash

And I get the JSON for the package.

On the docker image I run the same command and I get this:

curl: (35) error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol

When I npm install with the registry set it also returns the same issue.

Why can't docker access the same endpoint that my host machine can? How can I enable it to?

ThomasReggi
  • 55,053
  • 85
  • 237
  • 424

3 Answers3

1

Try using the host's network. If you are able to access that URL from your local, then it should work. You just need to add the --network host argument to your build/run command.

Example:

$ docker build <all the other args> --network host .
$ docker run <all the other args> --network host .

Docker creates a bridge network by default but you can force it to use your local network with --network host arg.

Fabian Rivera
  • 1,138
  • 7
  • 15
1

I encountered a similar issue, which was there is a docker network created by some compose file remains there

docker network ls

I removed the danging one and retain the intranet access

Deo Leung
  • 848
  • 9
  • 9
0

A bit late but it migh thelp someone. I had the same problem and my solution was configure docker daemon to use my intranet DNS

Edit the daemon.json file

sudo vim /etc/docker/daemon.json

The file should look something like this

{
  "dns": ["ip-here", "ip-here"]
}

Restart de daemon

sudo service docker restart
lleon
  • 2,615
  • 1
  • 20
  • 14