docker-compose build加速构建

1
pip3 install docker-compose

docker-compose build快速构建

下载过慢

image-20201017171838774

sed -i “s@http://deb.debian.org@https://mirrors.xxx.com@g" /etc/apt/sources.list

修改Dockerfile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
FROM debian:jessie

MAINTAINER phithon <root@leavesongs.com>

ADD https://gitee.com/iqiqiya/wait-for-it/raw/master/wait-for-it.sh /wait-for-it.sh

RUN sed -i "s@deb.debian.org@mirrors.aliyun.com@g" /etc/apt/sources.list && sed -i "s@security.debian.org@mirrors.aliyun.com@g" /etc/apt/sources.list

RUN set -ex \ && apt-get update \
&& apt-get install curl -y --no-install-recommends \
&& chmod +x /wait-for-it.sh \
&& { \
echo '#!/bin/bash'; \
echo '/wait-for-it.sh ${COUCHDB_URL}'; \
echo 'curl -X PUT http://${COUCHDB_AUTH}@${COUCHDB_URL}/_users'; \
echo 'curl -X PUT http://${COUCHDB_AUTH}@${COUCHDB_URL}/_replicator'; \
echo 'curl -X PUT http://${COUCHDB_AUTH}@${COUCHDB_URL}/_global_changes'; \
} | tee /run.sh \
&& chmod +x /run.sh \
&& rm -rf /var/lib/apt/lists/*

CMD ["/run.sh"]

遇到的错误

sed: -e expression #1, char 37: unknown option to `s’

❌s@deb.debian.org@mirrors.aliyun.com/debian/g

✅s@deb.debian.org@mirrors.aliyun.com@g