1. Conditions: Docker has been installed.

Docker is being developed at a pace of one release per month. The naming rules are as follows: year-month-ce, where CE indicates the community version.

The Docker version used in this article is 18.063-CE.

Docker CE contains the Docker engine, Docker command line and packaging tools. There are other online to moby or separate Docker engine packaging experience, by comparison or DOCker CE compilation packaging is the most comprehensive and appropriate, so packaged out has been RPM package can be installed directly, rather than the need to manually replace docker binary package!

  1. Download the source code

    git clone https://github.com/docker/docker-ce

  • Network speed touching! Take the fast lane: gitee.com/mumu7/docke…
  1. 163MiB size of the source, download finished!
cd docker-ce
Copy the code
  1. Switch branch
Git checkout - b v18.06.3 - ceCopy the code

cd ./components/packaging/rpm/

  1. Compile the package command:
Make VERSION = 18.06.3 - ce ENGINE_DIR = / path - to - docker/docker - ce/components/engine CLI_DIR=/path-to-docker/docker-ce/components/cli centos-7Copy the code
  1. Sure enough, not so smooth, immediately failed to compile:buildkit not supported by daemon!

docker run --rm -v /root/qzy/docker-src/docker-ce/components/packaging/rpm:/v -w /v alpine chown -R root:root rpmbuild
DOCKER_BUILDKIT=1 docker build  --build-arg GO_IMAGE=golang:1.13.10-buster -t rpmbuild-centos-7/x86_64 -f centos-7/Dockerfile .
Copy the code

I have DOCKER_BUILDKIT=1, so I’m going to try to change DOCKER_BUILDKIT=0. This is set at about 16 lines in the Makefile in the RPM directory! Save and you can continue compiling.

The reason is that the docker download does not support BuildKit, so you need to turn DOCKER_BUILDKIT off. Don’t struggle!

  1. Install/update a lot of dependencies, download a lot of code blocks from Github, 10 minutes, error:

fatal: unable to access 'https://github.com/krallin/tini.git/': Failed connect to github.com:443; Connection timed out

  1. It is indeed a network problem, try downloading TINi twice to complete, continue downloading dependencies. After several retries due to network problems, the compilation is complete:

    exit 0Indicates normal exit.

  2. Enter the docker – ce/components/packaging/RPM/rpmbuild/RPMS/x86_64 view:

  3. Copy RPM to another machine to install. Docker-ce: install docker-CE: install docker-CE: install docker-CE: install docker-CE: install docker-CE: install docker-CE: install docker-CE: install docker-CE If you encounter problems, please reply to exchange!