0%

docker通过代理进行构建dockerfile

进行Dockerfile进行构建时候,由于无法进行直连外网连接,只能通过代理进行联网构建。相关配置如下以及遇到的几个问题。

Dockerfile

1
2
3
ENV http_proxy http://x.x.x.x:3128
ENV https_proxy https://x.x.x.x:3128
ENV no_proxy x.x.x.x

问题

问题1:curl: (35) error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number.

1
2
3
4
5
将Dockerfil里面的curl请求更改为wget
原:
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
新:
RUN wget -qO - https://packages.microsoft.com/keys/microsoft.asc | apt-key add

问题2: Could not handshake: An unexpected TLS packet was received. [IP: x.x.x.x 3218]

1
2
3
4
修改代理配置
cat /etc/apt/apt.conf
Acquire::http::proxy "http://x.x.x.x:3128";
Acquire::https::proxy "https://x.x.x.x:3128";