【发布时间】:2020-10-09 03:39:44
【问题描述】:
我正在尝试在公司代理后面使用docker-compose build,但由于某种原因,您插入代理设置的区域似乎都不允许它完成这些步骤。
我使用的是 CentOS 8 服务器。
错误信息:
[root@centos8server docker]# docker-compose build
postgres uses an image, skipping
start_dependencies uses an image, skipping
Building custom-docker
Step 1/15 : FROM swift:5.2.3 as builder
---> 67a9c8f156c1
Step 2/15 : ARG env
---> Using cache
---> b767ab90fbe8
Step 3/15 : RUN apt-get -qq update && apt-get install -y libssl-dev zlib1g-dev && rm -r /var/lib/apt/lists/*
---> Running in b935c12d0bbd
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package libssl-dev
ERROR: Service 'custom-docker' failed to build: The command '/bin/sh -c apt-get -qq update && apt-get install -y libssl-dev zlib1g-dev && rm -r /var/lib/apt/lists/*' returned a non-zero code: 100
我最初的想法是 CentOS 服务器正在使用不存在的 apt 和 apt-get,但我随后在家中构建了服务器,没有代理限制,它就可以正常工作。我可以wget 地址,那里没有问题。
我已尝试在以下区域添加代理:
1. proxy for build and compose
除了我在任何用户帐户中都没有.docker 文件夹,所以我创建了目录和文件
nano ~/.docker/config.json
{
"proxies": {
"default": {
"httpProxy": "http://proxy.server:port",
"httpsProxy": "http://proxy.server:port",
"noProxy": "localhost,127.0.0.1"
}
}
}
我知道过去唯一存在的问题是我们的代理是 Basic-Auth,但无法找到如何添加它或是否有必要添加它。
【问题讨论】:
标签: docker proxy centos centos8