docker 源码编译调试

https://mdchao2010.github.io/2020/09/18/Docker-install-with-source/

1
2
3


 git clone -b v19.03.12 https://github.com/moby/moby.git   $GOPATH/src/github.com/docker/docker
1
2
cd /$GOPATH/src/github.com/docker/docker
make binary

成功编译的教程

按照这个博客的教程,我成功了

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
echo '{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Docker Daemon Debug",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "program": "${workspaceFolder}/cmd/dockerd/",
        }
    ]
}' > ./.vscode/launch.json

要安装依赖环境: 我的是 arch linux 环境 和 ubuntu的不一样,就按照命令给的包往上装,能装多少装多少

1
apt-get update && apt-get install -y  build-essential curl cmake gcc git libapparmor-dev libbtrfs-dev libdevmapper-dev libseccomp-dev ca-certificates e2fsprogs iptables pkg-config pigz procps xfsprogs xz-utils aufs-tools vim-common
1
2
3
4

# arch 安装依赖包
pacman -S   pigz
# 把 apt-get 改为 pacman 即可