最近在嘗試閱讀Docker源碼,一直想弄明白docker關于namespace等的代碼的在哪,以及怎么觸發。然而在閱讀時發現根本找不到代碼。。。想著還是先源碼安裝下docker,然后邊運行邊打印些調試信息看看再說
安裝之前
Docker源碼需在docker容器編譯環境中編譯,所以先安裝docker,安裝環境依舊是ubuntu14.04
echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.listsudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609Dsudo apt-get updatesudo apt-get upgradesudo apt-get install docker-engine
起初是使用apt-get install docker.io安裝,但在編譯源碼的時候會遇到ARG錯誤。
安裝
docker的安裝命令很簡單,雖然錯誤很多= =
apt-get install make git golanggit clone https://git@github.com/docker/dockercd dockermake buildmake binary
遇到的問題與解決方案
Unknown instruction: ARG
原因:
Docker Hub's automated build is still running Docker 1.8 and doesn't support ARG yet. There is a github issue tracking their upgrade to 1.9.
解決方案:采用安裝最新的docker-engine方式
docker daemon啟動失敗
復制代碼 代碼如下:
FATA[0000] Error starting daemon: error initializing graphdriver: "/var/lib/docker" contains several valid graphdrivers: aufs, devicemapper; Please cleanup or explicitly choose storage driver (-s <DRIVER>)解決方案:移除devicemap文件夾,如 mv /var/lib/docker/devicemapper/ .
make build出錯一
Step 6 : RUN apt-get update && apt-get install -y apparmor apt-utils aufs-tools automake bash-completion binutils-mingw-w64 bsdmainutils btrfs-tools build-essential clang createrepo curl dpkg-sig gcc-mingw-w64 git iptables jq libapparmor-dev libcap-dev libltdl-dev libsqlite3-dev libsystemd-journal-dev libtool mercurial net-tools pkg-config python-dev python-mock python-pip python-websocket ubuntu-zfs xfsprogs libzfs-dev tar zip --no-install-recommends && pip install awscli==1.10.15---> Running in 32ad02db3575Get:1 http://ppa.launchpad.net trusty InRelease [15.5 kB]Ign http://httpredir.debian.org jessie InReleaseGet:2 http://httpredir.debian.org jessie-updates InRelease [142 kB]Get:3 http://security.debian.org jessie/updates InRelease [63.1 kB]Get:4 http://httpredir.debian.org jessie Release.gpg [2373 B]Get:5 http://ppa.launchpad.net trusty/main amd64 Packages [5150 B]Get:6 http://httpredir.debian.org jessie-updates/main amd64 Packages [17.6 kB]Get:7 http://httpredir.debian.org jessie Release [148 kB]Get:8 http://httpredir.debian.org jessie/main amd64 Packages [9035 kB]Get:9 http://security.debian.org jessie/updates/main amd64 Packages [232 kB]Fetched 9662 kB in 19s (504 kB/s)W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie/main/binary-amd64/Packages Hash Sum mismatchW: Failed to fetch http://security.debian.org/dists/jessie/updates/main/binary-amd64/Packages Hash Sum mismatchE: Some index files failed to download. TheW: Failed to fetch http://httpredir.debian.org/debian/dists/jessie/main/binary-amd64/Packages Hash Sum mismatch
新聞熱點
疑難解答