下载源码
wget https://ghproxy.com/https://github.com/moby/moby/archive/refs/tags/v20.10.11.tar.gz
解压
tar -xvf v20.10.11.tar.gz
打patch(国内网络问题)
[root@10-2-1-202 src]# cd moby-20.10.13
[root@10-2-1-202 moby-20.10.13]# patch -p1 < ../docker.patch
patching file Dockerfile
patching file hack/dockerfile/install/containerd.installer
patching file hack/dockerfile/install/proxy.installer
patching file hack/dockerfile/install/rootlesskit.installer
patching file hack/dockerfile/install/runc.installer
patching file hack/dockerfile/install/tini.installer
patching file hack/dockerfile/install/tomlv.installer
patching file sources.list.buster
docker.patch
diff -uprN moby-20.10.13/Dockerfile moby-20.10.13-fixed/Dockerfile
--- moby-20.10.13/Dockerfile 2022-03-07 04:52:27.000000000 +0800
+++ moby-20.10.13-fixed/Dockerfile 2022-03-14 15:57:54.979953557 +0800
@@ -16,6 +16,7 @@ RUN echo 'Binary::apt::APT::Keep-Downloa
ARG APT_MIRROR
RUN sed -ri "s/(httpredir|deb).debian.org/${APT_MIRROR:-deb.debian.org}/g" /etc/apt/sources.list \
&& sed -ri "s/(security).debian.org/${APT_MIRROR:-security.debian.org}/g" /etc/apt/sources.list
+ADD sources.list.buster /etc/apt/sources.list
ENV GO111MODULE=off
FROM base AS criu
diff -uprN moby-20.10.13/hack/dockerfile/install/containerd.installer moby-20.10.13-fixed/hack/dockerfile/install/containerd.installer
--- moby-20.10.13/hack/dockerfile/install/containerd.installer 2022-03-07 04:52:27.000000000 +0800
+++ moby-20.10.13-fixed/hack/dockerfile/install/containerd.installer 2022-03-14 15:25:32.935341967 +0800
@@ -19,7 +19,7 @@ set -e
install_containerd() (
echo "Install containerd version $CONTAINERD_VERSION"
- git clone https://github.com/containerd/containerd.git "$GOPATH/src/github.com/containerd/containerd"
+ git clone https://ghproxy.com/https://github.com/containerd/containerd.git "$GOPATH/src/github.com/containerd/containerd"
cd "$GOPATH/src/github.com/containerd/containerd"
git checkout -q "$CONTAINERD_VERSION"
diff -uprN moby-20.10.13/hack/dockerfile/install/proxy.installer moby-20.10.13-fixed/hack/dockerfile/install/proxy.installer
--- moby-20.10.13/hack/dockerfile/install/proxy.installer 2022-03-07 04:52:27.000000000 +0800
+++ moby-20.10.13-fixed/hack/dockerfile/install/proxy.installer 2022-03-14 15:25:44.055368370 +0800
@@ -29,7 +29,7 @@ install_proxy_dynamic() {
_install_proxy() {
echo "Install docker-proxy version $LIBNETWORK_COMMIT"
- git clone https://github.com/docker/libnetwork.git "$GOPATH/src/github.com/docker/libnetwork"
+ git clone https://ghproxy.com/https://github.com/docker/libnetwork.git "$GOPATH/src/github.com/docker/libnetwork"
cd "$GOPATH/src/github.com/docker/libnetwork"
git checkout -q "$LIBNETWORK_COMMIT"
go build ${BUILD_MODE} -ldflags="$PROXY_LDFLAGS" -o ${PREFIX}/docker-proxy github.com/docker/libnetwork/cmd/proxy
diff -uprN moby-20.10.13/hack/dockerfile/install/rootlesskit.installer moby-20.10.13-fixed/hack/dockerfile/install/rootlesskit.installer
--- moby-20.10.13/hack/dockerfile/install/rootlesskit.installer 2022-03-07 04:52:27.000000000 +0800
+++ moby-20.10.13-fixed/hack/dockerfile/install/rootlesskit.installer 2022-03-14 15:20:27.994617943 +0800
@@ -26,6 +26,8 @@ install_rootlesskit_dynamic() {
_install_rootlesskit() (
echo "Install rootlesskit version ${ROOTLESSKIT_VERSION}"
+ # 国内支持
+ go env -w GOPROXY=https://goproxy.cn
for f in rootlesskit rootlesskit-docker-proxy; do
GOBIN="${PREFIX}" GO111MODULE=on go install ${BUILD_MODE} -ldflags="$ROOTLESSKIT_LDFLAGS" "github.com/rootless-containers/rootlesskit/cmd/${f}@${ROOTLESSKIT_VERSION}"
done
diff -uprN moby-20.10.13/hack/dockerfile/install/runc.installer moby-20.10.13-fixed/hack/dockerfile/install/runc.installer
--- moby-20.10.13/hack/dockerfile/install/runc.installer 2022-03-07 04:52:27.000000000 +0800
+++ moby-20.10.13-fixed/hack/dockerfile/install/runc.installer 2022-03-14 15:25:54.635393490 +0800
@@ -15,7 +15,7 @@ install_runc() {
RUNC_BUILDTAGS="${RUNC_BUILDTAGS:-"seccomp"}"
echo "Install runc version $RUNC_VERSION (build tags: $RUNC_BUILDTAGS)"
- git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc"
+ git clone https://ghproxy.com/https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc"
cd "$GOPATH/src/github.com/opencontainers/runc"
git checkout -q "$RUNC_VERSION"
if [ -z "$1" ]; then
diff -uprN moby-20.10.13/hack/dockerfile/install/tini.installer moby-20.10.13-fixed/hack/dockerfile/install/tini.installer
--- moby-20.10.13/hack/dockerfile/install/tini.installer 2022-03-07 04:52:27.000000000 +0800
+++ moby-20.10.13-fixed/hack/dockerfile/install/tini.installer 2022-03-14 15:26:04.465416830 +0800
@@ -7,7 +7,7 @@
install_tini() {
echo "Install tini version $TINI_VERSION"
- git clone https://github.com/krallin/tini.git "$GOPATH/tini"
+ git clone https://ghproxy.com/https://github.com/krallin/tini.git "$GOPATH/tini"
cd "$GOPATH/tini"
git checkout -q "$TINI_VERSION"
cmake .
diff -uprN moby-20.10.13/hack/dockerfile/install/tomlv.installer moby-20.10.13-fixed/hack/dockerfile/install/tomlv.installer
--- moby-20.10.13/hack/dockerfile/install/tomlv.installer 2022-03-07 04:52:27.000000000 +0800
+++ moby-20.10.13-fixed/hack/dockerfile/install/tomlv.installer 2022-03-14 15:26:14.715441166 +0800
@@ -6,7 +6,7 @@
install_tomlv() {
echo "Install tomlv version $TOMLV_COMMIT"
- git clone https://github.com/BurntSushi/toml.git "$GOPATH/src/github.com/BurntSushi/toml"
+ git clone https://ghproxy.com/https://github.com/BurntSushi/toml.git "$GOPATH/src/github.com/BurntSushi/toml"
cd "$GOPATH/src/github.com/BurntSushi/toml" && git checkout -q "$TOMLV_COMMIT"
go build -v ${GO_BUILDMODE} -o "${PREFIX}/tomlv" "github.com/BurntSushi/toml/cmd/tomlv"
}
diff -uprN moby-20.10.13/sources.list.buster moby-20.10.13-fixed/sources.list.buster
--- moby-20.10.13/sources.list.buster 1970-01-01 08:00:00.000000000 +0800
+++ moby-20.10.13-fixed/sources.list.buster 2020-12-28 12:06:30.000000000 +0800
@@ -0,0 +1,8 @@
+deb http://mirrors.163.com/debian/ buster main non-free contrib
+deb http://mirrors.163.com/debian/ buster-updates main non-free contrib
+deb http://mirrors.163.com/debian/ buster-backports main non-free contrib
+deb-src http://mirrors.163.com/debian/ buster main non-free contrib
+deb-src http://mirrors.163.com/debian/ buster-updates main non-free contrib
+deb-src http://mirrors.163.com/debian/ buster-backports main non-free contrib
+deb http://mirrors.163.com/debian-security/ buster/updates main non-free contrib
+deb-src http://mirrors.163.com/debian-security/ buster/updates main non-free contrib
执行构建
make binary
查看编译版本
[root@10-2-1-202 moby-20.10.13]# ll bundles/binary-daemon/
total 194172
-rwxr-xr-x 1 root root 31844584 Mar 14 16:02 containerd
-rw-r--r-- 1 root root 45 Mar 14 16:02 containerd.md5
-rw-r--r-- 1 root root 77 Mar 14 16:02 containerd.sha256
-rwxr-xr-x 1 root root 6160384 Mar 14 16:02 containerd-shim
-rw-r--r-- 1 root root 50 Mar 14 16:02 containerd-shim.md5
-rwxr-xr-x 1 root root 8388608 Mar 14 16:02 containerd-shim-runc-v2
-rw-r--r-- 1 root root 58 Mar 14 16:02 containerd-shim-runc-v2.md5
-rw-r--r-- 1 root root 90 Mar 14 16:02 containerd-shim-runc-v2.sha256
-rw-r--r-- 1 root root 82 Mar 14 16:02 containerd-shim.sha256
-rwxr-xr-x 1 root root 21037056 Mar 14 16:02 ctr
-rw-r--r-- 1 root root 38 Mar 14 16:02 ctr.md5
-rw-r--r-- 1 root root 70 Mar 14 16:02 ctr.sha256
lrwxrwxrwx 1 root root 11 Mar 14 16:02 dockerd -> dockerd-dev
-rwxr-xr-x 1 root root 58483096 Mar 14 16:02 dockerd-dev
-rw-r--r-- 1 root root 46 Mar 14 16:02 dockerd-dev.md5
-rw-r--r-- 1 root root 78 Mar 14 16:02 dockerd-dev.sha256
-rwxr-xr-x 1 root root 13348 Mar 14 16:02 dockerd-rootless-setuptool.sh
-rw-r--r-- 1 root root 64 Mar 14 16:02 dockerd-rootless-setuptool.sh.md5
-rw-r--r-- 1 root root 96 Mar 14 16:02 dockerd-rootless-setuptool.sh.sha256
-rwxr-xr-x 1 root root 5150 Mar 14 16:02 dockerd-rootless.sh
-rw-r--r-- 1 root root 54 Mar 14 16:02 dockerd-rootless.sh.md5
-rw-r--r-- 1 root root 86 Mar 14 16:02 dockerd-rootless.sh.sha256
-rwxr-xr-x 1 root root 505488 Mar 14 16:02 docker-init
-rw-r--r-- 1 root root 46 Mar 14 16:02 docker-init.md5
-rw-r--r-- 1 root root 78 Mar 14 16:02 docker-init.sha256
-rwxr-xr-x 1 root root 2769111 Mar 14 16:02 docker-proxy
-rw-r--r-- 1 root root 47 Mar 14 16:02 docker-proxy.md5
-rw-r--r-- 1 root root 79 Mar 14 16:02 docker-proxy.sha256
-rwxr-xr-x 1 root root 10103657 Mar 14 16:02 rootlesskit
-rwxr-xr-x 1 root root 6499684 Mar 14 16:02 rootlesskit-docker-proxy
-rw-r--r-- 1 root root 59 Mar 14 16:02 rootlesskit-docker-proxy.md5
-rw-r--r-- 1 root root 91 Mar 14 16:02 rootlesskit-docker-proxy.sha256
-rw-r--r-- 1 root root 46 Mar 14 16:02 rootlesskit.md5
-rw-r--r-- 1 root root 78 Mar 14 16:02 rootlesskit.sha256
-rwxr-xr-x 1 root root 13286472 Mar 14 16:02 runc
-rw-r--r-- 1 root root 39 Mar 14 16:02 runc.md5
-rw-r--r-- 1 root root 71 Mar 14 16:02 runc.sha256
-rwxr-xr-x 1 root root 39607984 Mar 14 16:02 vpnkit
-rw-r--r-- 1 root root 41 Mar 14 16:02 vpnkit.md5
-rw-r--r-- 1 root root 73 Mar 14 16:02 vpnkit.sha256
[root@10-2-1-202 binary-daemon]# file containerd
containerd: ELF 64-bit LSB executable, ARM aarch64, version 1 (GNU/Linux), statically linked, for GNU/Linux 3.7.0, BuildID[sha1]=a1968ee4fc8193386434736c99ead2a8107f08a1, stripped
[root@10-2-1-202 binary-daemon]# file containerd-shim
containerd-shim: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, stripped
[root@10-2-1-202 binary-daemon]# file containerd-shim-runc-v2
containerd-shim-runc-v2: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, stripped
[root@10-2-1-202 binary-daemon]# file ctr
ctr: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked (uses shared libs), stripped
[root@10-2-1-202 binary-daemon]# file dockerd-dev
dockerd-dev: ELF 64-bit LSB executable, ARM aarch64, version 1 (GNU/Linux), statically linked, for GNU/Linux 3.7.0, BuildID[sha1]=3648fb646d9ab4ce80c938fbaf7bc9b76bf36514, not stripped
[root@10-2-1-202 binary-daemon]# file docker-init
docker-init: ELF 64-bit LSB executable, ARM aarch64, version 1 (GNU/Linux), statically linked, for GNU/Linux 3.7.0, BuildID[sha1]=b7f88c2a8a0f401c6c6dce469db51d28f8b68a4b, stripped
[root@10-2-1-202 binary-daemon]# file docker-proxy
docker-proxy: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, not stripped
[root@10-2-1-202 binary-daemon]# file runc
runc: ELF 64-bit LSB executable, ARM aarch64, version 1 (GNU/Linux), statically linked, for GNU/Linux 3.7.0, BuildID[sha1]=f9a6e04b573c484eb2aa7879e6d6479fb4f67cc3, not stripped
|