This is a creation in Article, where the information may have evolved or changed.
Recently to modify the source of Docker to do some development, but Docker's website is compiled by using the Docker-provided dockerfile file to compile a docker image and then in this container through the footsteps of compiling Docker. We all know that Docker after 1.11 actually has several processes composed of Docker Dockerd Docker-containerd Runc. How can I modify it once to compile it all over again more trouble. So I decided to go to build a few executables for Docker.
1. Git clone Github.com/moby/moby now Docker's code has migrated from Docker/docker to/moby/moby. Of course you will need to install go before compiling. This Golang official website has to follow the instructions to install just fine.
2. Compiling Docker is the Docker client. Code under Cmd/docker, here I am the 1.13.x branch. There is also a docker/docker directory under your Gopath path you want to keep the branches under Docker and Moby under the same conditions. Otherwise the build will go wrong under Moby. Then go build. A docker bin file is generated.
3. Compile Dockerd compile dockerd, you need to install many packages. You can install the required packages based on the error message. For example, I'm fedora25. Go build will report libdevmapper.h missing. Then DNF install Device-mapper-devel.x86_6.
4. Compile the containerd. git clone github.com/docker/containerd. Compile containerd use Containerd's make file to compile the build. After compiling, Containerd-shim will be generated, containerd. Refer to Containerd's readme for details.
5. Compile build Runc. Runc is the tool that eventually launches the container, which can be said to be the core of the container. In fact no dockerd is also a variety of operations that send commands to Containerd Containerd and then start Containd-shim Containerd-shim and then call Runc to start the container to stop the container from running life cycle. In fact, there are no previous processes, you can send data directly to the Runc boot container. Of course, to meet the OCI standards. Refer to the Runc project's readme runc now in Https://github.com/opencontainers/runc. Docker changed its Libcontainer contribution and changed its name into a Runc project under CNCF. Runc compile to go build a bit. Look at GitHub's Readme written in very detailed.
Now the 5 bin files that Docker needs are all compiled and built. Docker Dockerd Containerd Containerd-shim and Runc, respectively. These executables are compiled primarily for the convenience of debugging Docker code. Later I will modify the Docker Dockerd Containerd and so on. See how data flows between these processes from a Docker run. How to call each other.