$ cat /etc/docker/daemon.json
{
"registry-mirrors": [
"https://mirror.ccs.tencentyun.com",
"http://registry.docker-cn.com",
"http://docker.mirrors.ustc.edu.cn",
"http://hub-mirror.c.163.com"
],
"insecure-registries" : [
"registry.docker-cn.com",
"docker.mirrors.ustc.edu.cn"
],
"debug" : true,
"experimental" : true
}
修改好之后重载配置并重启docker
# 重载配置
systemctl daemon-reload
# 重启docker服务
systemctl restart docker
参考:[alpine]源配置
$ docker run -it alpine
/ # cd /etc/apk/
/etc/apk # sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
/etc/apk # cat repositories
修改项目中的Dockerfile
,在Dockerfile
中的所有 FROM ...alpine...
语句后面添加一句:
RUN set -eux && sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
上述配置解决了make all
时出现的如下问题:
user@user-pc:~/codes/go/src/github.com/hyperledger/fabric$ make all
Building Docker image hyperledger/fabric-ccenv
docker build --force-rm -f images/ccenv/Dockerfile \
--build-arg GO_VER=1.14.4 \
--build-arg ALPINE_VER=3.12 \
\
-t hyperledger/fabric-ccenv ./images/ccenv
Sending build context to Docker daemon 2.048kB
Step 1/8 : ARG GO_VER
Step 2/8 : ARG ALPINE_VER
Step 3/8 : FROM golang:${GO_VER}-alpine${ALPINE_VER}
---> 3289bf11c284
Step 4/8 : RUN apk add --no-cache g++ gcc git musl-dev
---> Running in 0d7440835aee
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz: temporary error (try again later)
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz: temporary error (try again later)
ERROR: unsatisfiable constraints: