Prerequisites for compiling Docker
Now in the company to do Docker container These technologies, Docker compiled online check wood is reliable. I had to get my hands on it.
Disclaimer: You do not need git pull its source code to compile Docker, the prerequisite is only one, you have a pull image of the Docker host on the line.
My environment is VMware under CentOS Linux release 7.1.1503 (Core) [x86_64]
The following is a specific record of the compilation process
Image of 1.pull docker-dev:1.8.2
[[email protected] docker]# Docker pull docker-dev:1.8.2pulling repository docker-devab03141ac2e9:pulling Dependent Layersd3a1f33e8a5a:download completec22013c84729:download Completed74508fb6632:download Complete91e54dfb1179:download complete758970a22420:download complete62fd5b9e4d35:download complete944fcdea21b1: Download completeab975b7812f0:download complete0f860819eb9c:download Completeadcf22790962:download Completec79325ee5872:download complete115d2806e84a:download complete1705282a2f45:download complete5d8bf41b5802: Download complete3388f79cde5c:download complete979009c412cd:download Complete11eaa2b57f9e:download Completeb3ff0a3e16f1:download completea7cc3d81aeed:download complete94b8248ce242:download complete006aa3cb8d92: Download complete5ce85bb004d1:download complete28907ad32b10:download Complete919096bcd935:download Complete2a138d63ee40:download complete2b2733893e80:download completeab03141ac2e9:download Complete906727032fc8: Download completec296523a5eea:download completef38d4f3bc631:download completeb5564cf04aab:download Completecd3a9bdbad49:download Completea223a267d4b0:download complete0912427504fa:download complete9d153769f49b:download complete4ec1b8c4c270: Download complete7ca719ee5f14:download complete3b994c4a49de:download Complete062d730e6007:download Completeac1892714a82:download completeac43d240b0a2:download completedbab3fbdd774:download complete79d657b6d894: Download complete725fa96f33ab:download completead50f4526814:download Completeee0aa2630de6:download Completea9314782dbbf:download complete23f7502170cd:download complete8bfc29dd7728:download CompleteStatus: Downloaded newer image for docker-dev:1.8.2
2. Create a directory to hold the files generated by the Docker compilation
[Email protected] home]# mkdir-p/home/dockerbuild/bundles[[email protected] home]# cd/home/dockerbuild/
3. Run the Docker-dev image that you just pull, and then do the Docker compilation in the container
[email protected] home]# Docker run--rm-it--privileged- e buildflags-e docker_clientonly-e docker_execdriver-e Docker_experimental- e docker_graphdriver-e docker_storage_opts-e docker_userlandproxy-e testdirs-e testflags-e TIMEOUT -v/home/dockerbuild/bundles:/go/src/github.com/docker/docker/bundles docker-dev:1.8.2 bash [ Email protected]:/go/src/github.com/docker/docker# hack/make.sh Binary---> Making bundle:binary (in bundles/1.8.2/ binary) building:bundles/1.8.2/binary/docker-1.8.2created binary:bundles/1.8.2/binary/docker-1.8.2
4. Review the compilation output and verify the results of the compilation
[Email protected]:/go/src/github.com/docker/docker# ls-l bundles/1.8.2/binary/total 21104lrwxrwxrwx 1 root root Sep 10:20 Docker--docker-1.8.2-rwxr-xr-x 1 root root 21599668 Sep 10:20 docker-1.8.2-rw-r--r--1 root root
47 Sep 10:20 docker-1.8.2.md5-rw-r--r--1 root root- Sep-10:20 docker-1.8.2.sha256
As you can see in the container, the bundles directory already has a compiled Docker program file. After exiting the container, you will get a compiled docker in the native/home/dockerbuild/bundles/1.8.2/binary directory.
[[Email protected] dockerbuild]# CD Bundles/[[email protected] bundles]# ls1.8.2 latest[[email protected] bundles]# CD 1.8.2/[[email protected] 1.8.2]# lsbinary[[email protected] binary]# ls-ltotal 21104lrwxrwxrwx 1 root root Sep 18:20 Docker--docker-1.8.2-rwxr-xr-x 1 root root 21599668 Sep 18:20 docker-1.8.2-rw-r--r--1 root root EP 18:20 docker-1.8.2.md5-rw-r--r--1 root root ( Sep) 18:20 docker-1.8.2.sha256[[email protected] binary]#./do Cker versionclient:version: 1.8.2 API Version: 1.20 Go Version: go1.4.2 Git commit: 0a8c2e3 Built: Tue Sep 10:20:40 UTC os/arch: linux/amd64error response from daemon:client and server don ' t has same ve Rsion (Client API version:1.20, Server API version:1.19)
Off Topic
The official choice to compile Docker in a container is because the environment and components required to compile Docker are already integrated inside the container, and I am too lazy to rely on it in CentOS.
This is the end of this article, thank you.
Docker 1.8.2 Source code compilation