Alpine 系统跟 Ubuntu 一样也有包管理器,为 apk ,正常通过 apk 安装软件速度都会比较慢,原因你懂的。

Dockerfile 如下:

1
2
3
4
5
6
7
FROM alpine

MAINTAINER ismdeep ismdeep@protonmail.com

RUN echo "https://mirrors.aliyun.com/alpine/latest-stable/main/" > /etc/apk/repositories
RUN apk --no-cache add python libsodium wget
ENTRYPOINT ["/sh"]

通过 Docker 构建如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
> docker build -t alphine-mirror .
Sending build context to Docker daemon 2.048kB
Step 1/5 : FROM alpine
---> 055936d39205
Step 2/5 : MAINTAINER ismdeep ismdeep@protonmail.com
---> Running in 9fd23d8dd442
Removing intermediate container 9fd23d8dd442
---> 1f692ecb9ecb
Step 3/5 : RUN echo "https://mirrors.aliyun.com/alpine/latest-stable/main/" > /etc/apk/repositories
---> Running in 7305f6170393
Removing intermediate container 7305f6170393
---> 8036d7c7bcf6
Step 4/5 : RUN apk --no-cache add python libsodium wget
---> Running in 10620e66ed0e
fetch https://mirrors.aliyun.com/alpine/latest-stable/main/x86_64/APKINDEX.tar.gz
(1/12) Installing libsodium (1.0.16-r0)
(2/12) Installing libbz2 (1.0.6-r6)
(3/12) Installing expat (2.2.6-r0)
(4/12) Installing libffi (3.2.1-r6)
(5/12) Installing gdbm (1.13-r1)
(6/12) Installing ncurses-terminfo-base (6.1_p20190105-r0)
(7/12) Installing ncurses-terminfo (6.1_p20190105-r0)
(8/12) Installing ncurses-libs (6.1_p20190105-r0)
(9/12) Installing readline (7.0.003-r1)
(10/12) Installing sqlite-libs (3.28.0-r0)
(11/12) Installing python2 (2.7.16-r1)
(12/12) Installing wget (1.20.3-r0)
Executing busybox-1.29.3-r10.trigger
OK: 53 MiB in 26 packages
Removing intermediate container 10620e66ed0e
---> 1d9aecf539f2
Step 5/5 : ENTRYPOINT ["/sh"]
---> Running in 366c2b8bfa68
Removing intermediate container 366c2b8bfa68
---> 41e3a76460bb
Successfully built 41e3a76460bb
Successfully tagged alphine-mirror:latest