Solution Approach for Using Proxy in Docker Build
Problem Description When using docker build to package an image, there is a need to access the network via a proxy. The following Dockerfile simulates this scenario: FROM golang:1.12 RUN curl www.google.com --max-time 3 In a typical network environment in China, curl www.google.com cannot return normally. The --max-time option is added to ensure the curl command does not take too long. Configuring the http_proxy Variable First, you need to set the http_proxy and https_proxy environment variables so that network access commands (represented here by curl) can access www.google.com through the proxy server configured in the environment variables. ...