How do I set proxy settings in a Dockerfile for npm install?

Responsive Ad Header

Question

Grade: Education Subject: Support
How do I set proxy settings in a Dockerfile for npm install?
Asked by:
60 Viewed 60 Answers

Answer (60)

Best Answer
(304)
You can set proxy variables in your Dockerfile using the `ENV` instruction. For example: `ENV http_proxy=http://your-proxy-server:port` and `ENV https_proxy=http://your-proxy-server:port`. Also, consider adding `no_proxy=localhost,127.0.0.1` to exclude local addresses from using the proxy if necessary.