In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Purpose
1) go to dockerfile to deal with network request problems and shorten compilation time
2) facilitate internal unified version maintenance
3) facilitate access to internal assembly line operations
4) compile the static version to avoid the dynamic dependency of the system library
1) system environment [root@localhost] # cat / etc/redhat-release CentOS Linux release 7.6.1810 (Core) # uname-aLinux localhost.localdomain 3.10.0-957.el7.x86_64 # 1 SMP Thu Nov 8 23:39:32 UTC 2018 x86'64'64 x86'64 x86'64 GNU/Linuxdocker version: docker-ce-18.092) docker related
Docker-ce change
Dokcer changed from moby project to docker-ce,docker client project separated from server project.
The docker client code block is in the cli directory
Docker server code block in engine
Containerd runc proxy init has not changed
The relevant project documents can be found in:
The version varies slightly, the latest version (18.09), and the related commit id is also in the installer file.
Docker-ce/components/engine/hack/dockerfile/install/
Containerd.installer gometalinter.installer proxy.installer tini.installer vndr.installer
Dockercli.installer install.sh runc.installer tomlv.installer
For golang version, please see: docker-ce/components/engine/Dockerfile.e2e
Related project code base:
Https://github.com/opencontainers/runc.git docker-runc
Https://github.com/krallin/tini.git docker-init
Https://github.com/containerd/containerd.git docker-containerd | | docker-containerd-shim | | docker-containerd-ctr
Https://github.com/docker/docker-ce.git docker | | dockerd
Https://github.com/docker/libnetwork.git docker-proxy
3) find the corresponding golang version, cat docker-ce/components/engine/Dockerfile.e2e docker-ce/components/engine/Dockerfile.e2e:FROM golang:1.10.6-alpine3.7 as builder, find the original correspondence from the corresponding dockerfile of docker and golang, and choose to download the uncompiled go version https://dl.google.com/go/go1. directly. 10.6.linux-amd64.tar.gz4) configure the basic compilation environment
According to the docker image compilation mode of containerd, we can know that the gcc version of redhat series is too low and does not support enable-default-pie option, so we need to install and compile gcc 6.3.x version.
Compile runc Times / usr/bin/ld: cannot find-lseccomp, default redhat series without libseccomp-static support
A) delete the original libseccomp package
Rpm-ivh https://cbs.centos.org/kojifiles/packages/libseccomp/2.3.2/3.el7/x86_64/libseccomp-2.3.2-3.el7.x86_64.rpm https://cbs.centos.org/kojifiles/packages/libseccomp/2.3.2/3.el7/x86_64/libseccomp-devel-2.3.2-3.el7.x86_64.rpm https://cbs.centos.org/kojifiles/packages/libseccomp/2.3.2 / 3.el7/x86_64/libseccomp-static-2.3.2-3.el7.x86_64.rpm
[root@localhost src] # rpm-qa | grep libseccomp
Libseccomp-2.3.2-3.el7.x86_64
Libseccomp-static-2.3.2-3.el7.x86_64
Libseccomp-devel-2.3.2-3.el7.x86_64
B) compile using the gcc 6.3.0 environment
Yum group install "Development Tools"
Yum install redhat-lsb rpm-build rpm-sign check dejagnu expect zlib-devel
[root@localhost github.com] # git clone https://github.com/BobSteagall/gcc-builder.git
Cloning into 'gcc-builder'...
Remote: Enumerating objects: 215, done.
Remote: Total 215 (delta 0), reused 0 (delta 0), pack-reused 215
Receiving objects: 100% (215 KiB), 35.75 KiB | 0 bytes/s, done.
Resolving deltas: 100% (149amp 149), done.
[root@localhost github.com] # cd gcc-builder/
[root@localhost gcc-builder] # git checkout gcc6
Branch gcc6 set up to track remote branch gcc6 from origin.
Switched to a new branch 'gcc6'
[root@localhost gcc-builder] # vi gcc-build-vars.sh
Export GCC_VERSION=6.3.0
Root@localhost gcc-builder] # vi configure-gcc.sh
Elif ["$GCC_PLATFORM" = = "Linux"]
Then
$GCC_SRC_DIR/configure-v\
-with-pkgversion= "$GCC_PKG_NAME"\
-- enable-default-pie\-add enable-default-pie
-- enable-languages=c,c++\
[root@localhost gcc-builder] #. / build-gcc.sh | tee build.log
[root@localhost gcc-builder] #. / stage-gcc.sh
[root@localhost gcc-builder] #. / pack-gcc.sh
[root@localhost gcc-builder] # cd dist/usr/local
[root@localhost local] # cp-r bin/ gcc/ / usr/local/
[root@localhost local] # chown-R root:root / usr/local/gcc/6.3.0/
[root@localhost local] # chown root:root / usr/local/bin/gcc630
[root@localhost local] # source / usr/local/bin/setenv-for-gcc630.sh
[root@localhost local] # gcc-v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/gcc/6.3.0/libexec/gcc/x86_64-kewb-linux-gnu/6.3.0/lto-wrapper
Target: x86_64-kewb-linux-gnu
Configured with: / usr/local/docker/src/github.com/gcc-builder/gcc-6.3.0/configure-v-- with-pkgversion='KEWB Computing Build'-- prefix=/usr/local/gcc/6.3.0-- program-suffix=-- enable-tls-- enable-shared-enable-threads=posix-- enable-__cxa_atexit-- enable-clocale=gnu-- enable-default-pie-- enable-languages=c C++-enable-lto-enable-bootstrap-disable-nls-disable-multilib-disable-install-libiberty-disable-werror-with-system-zlib
Thread model: posix
Gcc version 6.3.0 (KEWB Computing Build)
Download the software compilation environment configuration go: / usr/local/go1.10.6
Dockerd: / usr/local/docker/src/github.com/docker/docker engine directory
Docker: / usr/local/docker/src/github.com/docker/cli
Proxy: / usr/local/docker/src/github.com/docker/libnetwork
Init: / usr/local/docker/src/github.com/tini
Runc: / usr/local/docker/src/github.com/opencontainers/runc
Containerd: / usr/local/docker/src/github.com/containerd/containerd/ download go to set environment variables
Cd / usr/local
Wget https://dl.google.com/go/go1.10.6.linux-amd64.tar.gz
Mkdir-p / usr/local/go1.10.6
Tar-C / usr/local/go1.10.6-zxvf go1.10.6.linux-amd64.tar.gz
Go_version=/usr/local/go1.10.6/go
Export PATH=$ {go_version} / bin/:$PATH
Export GOROOT=$ {go_version} /
Export GOPATH=/usr/local/docker
Export DOCKER_GITCOMMIT=4c52b90/18.09
Download docker dockerd docker-proxy related code
Mkdir-p / usr/local/docker/src/github.com/docker
Cd / usr/local/docker/src/github.com/docker
Git clone https://github.com/docker/docker-ce.git
Git clone https://github.com/docker/libnetwork.git
Cp-r docker-ce/components/engine docker
Cp-r docker-ce/components/cli cli
Download docker-init related code
Cd / usr/local/docker/src/github.com
Git clone https://github.com/krallin/tini.git
Download docker-runc related code
Mkdir-p / usr/local/docker/src/github.com/opencontainers
Cd / usr/local/docker/src/github.com/opencontainers
Git clone https://github.com/opencontainers/runc.git
Download docker-containerd... Related code
Mkdir-p / usr/local/docker/src/github.com/containerd
Cd / usr/local/docker/src/github.com/containerd
Git clone https://github.com/containerd/containerd.git
III. Compiling second-system files
Switch from docker-ce to version 18.09
Cd / usr/local/docker/src/github.com/docker/docker-ce
Git checkout 18.09
Branch 18.09 set up to track remote branch 18.09 from origin.
Switched to a new branch '18.09'
1) install the basic software package according to the docker compilation command
Docker-ce/components/packaging/image/Dockerfile.engine-dm
Yum group install-y'Development Tools'
Yum install-y bash ca-certificates cmake gcc git glibc-static libtool make
Yum install-y btrfs-progs-devel device-mapper-devel libseccomp-devel selinux-policy-devel systemd-devel
2) compile runc
Switch to the corresponding commit id (RUNC_COMMIT=96ec2177ae841256168fcf76954f7177af9446eb) according to docker-ce/components/engine/hack/dockerfile/install/runc.installer
Cd / usr/local/docker/src/github.com/opencontainers/runc
[root@localhost runc] # git checkout-Q 96ec2177ae841256168fcf76954f7177af9446eb
# If using RHEL7 kernels (3.10.0 el7), disable kmem accounting/limiting
[root@localhost runc] # make BUILDTAGS= "seccomp apparmor selinux nokmem" static
[root@localhost runc] # ldd runc
Not a dynamic executable
3) compile containerd
Compile according to the compilation command
Docker-ce/components/engine/hack/dockerfile/install/containerd.installer
CONTAINERD_COMMIT=9754871865f7fe2f4e74d43e2fc7ccd237edcbce # v1.2.2
Cd / usr/local/docker/src/github.com/containerd/containerd/
[root@localhost containerd] # git checkout-Q 9754871865f7fe2f4e74d43e2fc7ccd237edcbce
[root@localhost containerd] # make EXTRA_FLAGS= "- buildmode pie" EXTRA_LDFLAGS='-extldflags "- fno-PIC-static" 'BUILDTAGS= "netgo osusergo static_build"
[root@localhost containerd] # ldd bin/ctr
Not a dynamic executable
[root@localhost containerd] # ldd bin/containerd*
Bin/containerd:
Not a dynamic executable
Bin/containerd-shim:
Not a dynamic executable
Bin/containerd-shim-runc-v1:
Not a dynamic executable
Bin/containerd-stress:
Not a dynamic executable
4) compile docker-init
Cd / usr/local/docker/src/github.com/tini
[root@localhost tini] # git checkout-Q fec3683b971d9c3ef73f284f176672c44b44866
[root@localhost tini] # cmake.
[root@localhost tini] # make tini-static
[root@localhost tini] # ldd tini-static
Not a dynamic executable
[root@localhost tini] # cp tini-static docker-init
5) compile docker-proxy
Cd / usr/local/docker/src/github.com/docker/libnetwork
[root@localhost libnetwork] # git checkout-Q 2cfbf9b1f98162a55829a21cc603c76072a75382
[root@localhost libnetwork] # CGO_ENABLED=0 go build-o docker-proxy github.com/docker/libnetwork/cmd/proxy
[root@localhost libnetwork] # ldd docker-proxy
Not a dynamic executable
6) compile docker dockerd
Cd / usr/local/docker/src/github.com/docker/cli
[root@localhost cli] # export VERSION=18.09
[root@localhost cli] # export GITCOMMIT=4c52b90
[root@localhost cli] # make binary
WARNING: you are not in a container.
Use "make-f docker.Makefile binary" or set
DISABLE_WARN_OUTSIDE_CONTAINER=1 to disable this warning.
Press Ctrl+C now to abort.
WARNING: binary creates a Linux executable. Use cross for macOS or Windows.
. / scripts/build/binary
Building statically linked build/docker-linux-amd64
[root@localhost cli] # ldd build/docker
Not a dynamic executable
[root@localhost cli] # build/docker-v
Docker version 18.09, build 4c52b90
Cd / usr/local/docker/src/github.com/docker/docker
[root@localhost docker] # hack/make.sh binary
# WARNING! I don't seem to be running in a Docker container.
# The result of this command might be an incorrect build, and will not be
# officially supported.
# Try this instead: make all
Removing bundles/
-- > Making bundle: binary (in bundles/binary)
Building: bundles/binary-daemon/dockerd-18.09
Github.com/docker/docker/cmd/dockerd
/ tmp/go-link-867197439/000008.o: In function mygetgrouplist':/usr/local/go1.10.6/go/src/os/user/getgrouplist_unix.go:15: warning: Using 'getgrouplist' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking/tmp/go-link-867197439/000007.o: In functionmygetgrgid_r':
/ usr/local/go1.10.6/go/src/os/user/cgo_lookup_unix.go:38: warning: Using 'getgrgid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/ tmp/go-link-867197439/000007.o: In function mygetgrnam_r':/usr/local/go1.10.6/go/src/os/user/cgo_lookup_unix.go:43: warning: Using 'getgrnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking/tmp/go-link-867197439/000007.o: In functionmygetpwnam_r':
/ usr/local/go1.10.6/go/src/os/user/cgo_lookup_unix.go:33: warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/ tmp/go-link-867197439/000007.o: In function `mygetpwuid_r':
/ usr/local/go1.10.6/go/src/os/user/cgo_lookup_unix.go:28: warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
Created binary: bundles/binary-daemon/dockerd-18.09
[root@localhost docker] # bundles/binary-daemon/dockerd-v
Docker version 18.09, build 4c52b90/18.09
[root@localhost docker] # ldd bundles/binary-daemon/dockerd
Not a dynamic executable
Copy the compiled docker related second system files
[root@localhost ~] # mkdir / tmp/18.09-docker
[root@localhost ~] # cd / usr/local/docker/src/github.com
[root@localhost github.com] # cp docker/libnetwork/docker-proxy / tmp/18.09-docker/
[root@localhost github.com] # cp docker/cli/build/docker / tmp/18.09-docker/
[root@localhost github.com] # cp docker/docker/bundles/binary-daemon/dockerd / tmp/18.09-docker/
[root@localhost github.com] # cp containerd/containerd/bin/ctr containerd/containerd/bin/containerd containerd/containerd/bin/containerd-shim / tmp/18.09-docker/
[root@localhost github.com] # cp tini/docker-init / tmp/18.09-docker/
[root@localhost github.com] # cp opencontainers/runc/runc / tmp/18.09-docker/
[root@localhost github.com] # ls-lrt / tmp/18.09-docker/
Total 160688
-rwxr-xr-x. 1 root root 2841376 Jan 25 01:38 docker-proxy
-rwxr-xr-x. 1 root root 50711753 Jan 25 01:38 docker
-rwxr-xr-x. 1 root root 53918880 Jan 25 01:39 dockerd
-rwxr-xr-x. 1 root root 28075792 Jan 25 01:40 containerd
-rwxr-xr-x. 1 root root 4968800 Jan 25 01:40 containerd-shim
-rwxr-xr-x. 1 root root 15816304 Jan 25 01:40 ctr
-rwxr-xr-x. 1 root root 845080 Jan 25 01:41 docker-init
-rwxr-xr-x. 1 root root 7352008 Jan 25 01:42 runc
[root@localhost ~] # docker version
Client:
Version: 18.09
API version: 1.39
Go version: go1.10.6
Git commit: 4c52b90
Built: Fri Jan 25 10:31:01 2019
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 18.09
API version: 1.39 (minimum version 1.12)
Go version: go1.10.6
Git commit: 4c52b90/18.09
Built: Fri Jan 25 10:33:42 2019
OS/Arch: linux/amd64
Experimental: false
Reference:
Https://bobsteagall.com/2017/12/30/gcc-builder/
Https://askubuntu.com/questions/1078516/disable-enable-default-pie-for-gcc
Https://github.com/rust-lang/rust/issues/47037
Http://gnu.mirror.constant.com/gcc/
Https://github.com/containerd/containerd/blob/master/BUILDING.md
Https://cbs.centos.org/koji/buildinfo?buildID=17550
Https://download.docker.com/linux/static/stable/x86_64/
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 298
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.