欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

詳解Docker源碼編譯安裝

 更新時間:2017年03月27日 09:05:45   作者:lwyeluo  
本篇文章主要介紹了詳解Docker源碼編譯安裝,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧

最近在嘗試閱讀Docker源碼,一直想弄明白docker關(guān)于namespace等的代碼的在哪,以及怎么觸發(fā)。然而在閱讀時發(fā)現(xiàn)根本找不到代碼。。。想著還是先源碼安裝下docker,然后邊運行邊打印些調(diào)試信息看看再說

安裝之前

Docker源碼需在docker容器編譯環(huán)境中編譯,所以先安裝docker,安裝環(huán)境依舊是ubuntu14.04

echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install docker-engine

起初是使用apt-get install docker.io安裝,但在編譯源碼的時候會遇到ARG錯誤。

安裝

docker的安裝命令很簡單,雖然錯誤很多= =

apt-get install make git golang
git clone https://git@github.com/docker/docker
cd docker
make build
make 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啟動失敗

復(fù)制代碼 代碼如下:

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 32ad02db3575
Get:1 http://ppa.launchpad.net trusty InRelease [15.5 kB]
Ign http://httpredir.debian.org jessie InRelease
Get: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 mismatch

W: Failed to fetch http://security.debian.org/dists/jessie/updates/main/binary-amd64/Packages Hash Sum mismatch

E: Some index files failed to download. TheW: Failed to fetch http://httpredir.debian.org/debian/dists/jessie/main/binary-amd64/Packages Hash Sum mismatch

看樣子是源的問題哎╮(╯▽╰)╭

而且是RUN指令,應(yīng)該是dockerfile運行容器之后的源錯誤,so,看下docker/Dockerfile

# ARG APT_MIRROR=httpredir.debian.org
RUN sed -i s/httpredir.debian.org/$APT_MIRROR/g /etc/apt/sources.list

在這里修改了源~從網(wǎng)上重新找個ftp.cn.debian.org,然而,。。。還是錯。。。

好吧,那把這兩句直接全部注釋掉,用163的debian源內(nèi)容echo到容器里,執(zhí)行

復(fù)制代碼 代碼如下:

RUN echo "deb http://mirrors.163.com/debian/ jessie main non-free contrib\ndeb http://mirrors.163.com/debian/ jessie-updates main non-free contrib\ndeb http://mirrors.163.com/debian/ jessie-backports main non-free contrib\ndeb-src http://mirrors.163.com/debian/ jessie main non-free contrib\ndeb-src http://mirrors.163.com/debian/ jessie-updates main non-free contrib\ndeb-src http://mirrors.163.com/debian/ jessie-backports main non-free contrib\ndeb http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib\ndeb-src http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib" | tee /etc/apt/sources.list

再執(zhí)行make build,出現(xiàn)依賴問題,那就用aptitude吧

RUN apt-get update && apt-get install -y aptitude
RUN aptitude install -y \ 

(同時去掉–no-install-recommends\那一行)

make build出錯二

Step 15 : RUN set -x   && export SECCOMP_PATH="$(mktemp -d)"   && curl -fsSL "https://github.com/seccomp/libseccomp/releases/download/v${SECCOMP_VERSION}/libseccomp-${SECCOMP_VERSION}.tar.gz"     | tar -xzC "$SECCOMP_PATH" --strip-components=1   && (     cd "$SECCOMP_PATH"     && ./configure --prefix=/usr/local     && make     && make install && ldconfig   )   && rm -rf "$SECCOMP_PATH"
 ---> Running in 4ad66d28289d
+ mktemp -d
+ export SECCOMP_PATH=/tmp/tmp.TWPYfciRjC
+ curl -fsSL https://github.com/seccomp/libseccomp/releases/download/v2.3.1/libseccomp-2.3.1.tar.gz
+ tar -xzC /tmp/tmp.TWPYfciRjC --strip-components=1
curl: (56) SSL read: error:00000000:lib(0):func(0):reason(0), errno 104

gzip: stdin: unexpected end of file
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now

網(wǎng)絡(luò)問題,網(wǎng)上有說先下載下來再用ADD添加進去,結(jié)果發(fā)現(xiàn)校園網(wǎng)貌似訪問這挺快的,連上vpn再執(zhí)行就行了。。

make binary 出錯

復(fù)制代碼 代碼如下:

ERROR:/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: fork/exec /usr/bin/gcc: cannot allocate memory

內(nèi)存不足~增大虛擬機內(nèi)存唄

安裝結(jié)果

make build

這里寫圖片描述

make binary

這里寫圖片描述

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論