您好,登錄后才能下訂單哦!
本篇內容主要講解“Docker源碼編譯安裝的方法”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“Docker源碼編譯安裝的方法”吧!
安裝之前
docker源碼需在docker容器編譯環境中編譯,所以先安裝docker,安裝環境依舊是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啟動失敗
復制代碼 代碼如下:
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指令,應該是dockerfile運行容器之后的源錯誤,so,看下docker/dockerfile
# arg apt_mirror=httpredir.debian.org run sed -i s/httpredir.debian.org/$apt_mirror/g /etc/apt/sources.list
在這里修改了源~從網上重新找個ftp.cn.debian.org,然而,。。。還是錯。。。
好吧,那把這兩句直接全部注釋掉,用163的debian源內容echo到容器里,執行
復制代碼 代碼如下:
run echo "deb jessie main non-free contrib\ndeb jessie-updates main non-free contrib\ndeb jessie-backports main non-free contrib\ndeb-src jessie main non-free contrib\ndeb-src jessie-updates main non-free contrib\ndeb-src jessie-backports main non-free contrib\ndeb jessie/updates main non-free contrib\ndeb-src jessie/updates main non-free contrib" | tee /etc/apt/sources.list
再執行make build,出現依賴問題,那就用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
網絡問題,網上有說先下載下來再用add添加進去,結果發現校園網貌似訪問這挺快的,連上vpn再執行就行了。。
make binary 出錯
復制代碼 代碼如下:
error:/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: fork/exec /usr/bin/gcc: cannot allocate memory
內存不足~增大虛擬機內存唄
安裝結果
make build
make binary
到此,相信大家對“Docker源碼編譯安裝的方法”有了更深的了解,不妨來實際操作一番吧!這里是億速云網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。