摘要:修改代碼在容器內執行生成容器的配置文件進到,修改代碼再容器目錄構建這時再到目錄用我們構建的這個運行容器我們打印的信息出來了。
docker開發流程
注意容器構建時的信息:
Install runc version 992a5be178a62e026f4069f443c6164912adbf09 + git clone https://github.com/opencontainers/runc.git /tmp/tmp.NdftaLJucp/src/github.com/opencontainers/runc Cloning into "/tmp/tmp.NdftaLJucp/src/github.com/opencontainers/runc"... + cd /tmp/tmp.NdftaLJucp/src/github.com/opencontainers/runc + git checkout -q 992a5be178a62e026f4069f443c6164912adbf09 + make BUILDTAGS=seccomp apparmor selinux static CGO_ENABLED=1 go build -i -tags "seccomp apparmor selinux cgo static_build" -ldflags "-w -extldflags -static -X main.gitCommit="992a5be178a62e026f4069f443c6164912adbf09" -X main.version=1.0.0-rc3" -o runc . CGO_ENABLED=1 go build -i -tags "seccomp apparmor selinux cgo static_build" -ldflags "-w -extldflags -static -X main.gitCommit="992a5be178a62e026f4069f443c6164912adbf09" -X main.version=1.0.0-rc3" -o contrib/cmd/recvtty/recvtty ./contrib/cmd/recvtty + cp runc /usr/local/bin/docker-runc + install_containerd static + echo Install containerd version 8ef7df579710405c4bb6e0812495671002ce08e0 Install containerd version 8ef7df579710405c4bb6e0812495671002ce08e0 + git clone https://github.com/containerd/containerd.git /tmp/tmp.NdftaLJucp/src/github.com/containerd/containerd Cloning into "/tmp/tmp.NdftaLJucp/src/github.com/containerd/containerd"... + cd /tmp/tmp.NdftaLJucp/src/github.com/containerd/containerd + git checkout -q 8ef7df579710405c4bb6e0812495671002ce08e0 + make static cd ctr && go build -ldflags "-w -extldflags -static -X github.com/containerd/containerd.GitCommit=8ef7df579710405c4bb6e0812495671002ce08e0 " -tags "" -o ../bin/ctr cd containerd && go build -ldflags "-w -extldflags -static -X github.com/containerd/containerd.GitCommit=8ef7df579710405c4bb6e0812495671002ce08e0 " -tags "" -o ../bin/containerd cd containerd-shim && go build -ldflags "-w -extldflags -static -X github.com/containerd/containerd.GitCommit=8ef7df579710405c4bb6e0812495671002ce08e0 " -tags "" -o ../bin/containerd-shim + cp bin/containerd /usr/local/bin/docker-containerd + cp bin/containerd-shim /usr/local/bin/docker-containerd-shim + cp bin/ctr /usr/local/bin/docker-containerd-ctr + echo Install tini version 949e6facb77383876aeff8a6944dde66b3089574 + git clone https://github.com/krallin/tini.git /tmp/tmp.NdftaLJucp/tini Install tini version 949e6facb77383876aeff8a6944dde66b3089574 Cloning into "/tmp/tmp.NdftaLJucp/tini"... + cd /tmp/tmp.NdftaLJucp/tini + git checkout -q 949e6facb77383876aeff8a6944dde66b3089574 + cmake . -- The C compiler identification is GNU 4.9.2 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Performing Test HAS_BUILTIN_FORTIFY -- Performing Test HAS_BUILTIN_FORTIFY - Failed -- Configuring done -- Generating done -- Build files have been written to: /tmp/tmp.NdftaLJucp/tini + make tini-static Scanning dependencies of target tini-static [100%] Building C object CMakeFiles/tini-static.dir/src/tini.c.o Linking C executable tini-static [100%] Built target tini-static + cp tini-static /usr/local/bin/docker-init + export CGO_ENABLED=0 + install_proxy + echo Install docker-proxy version 7b2b1feb1de4817d522cc372af149ff48d25028e Install docker-proxy version 7b2b1feb1de4817d522cc372af149ff48d25028e + git clone https://github.com/docker/libnetwork.git /tmp/tmp.NdftaLJucp/src/github.com/docker/libnetwork Cloning into "/tmp/tmp.NdftaLJucp/src/github.com/docker/libnetwork"... + cd /tmp/tmp.NdftaLJucp/src/github.com/docker/libnetwork + git checkout -q 7b2b1feb1de4817d522cc372af149ff48d25028e + go build -ldflags= -o /usr/local/bin/docker-proxy github.com/docker/libnetwork/cmd/proxy + install_bindata + echo Install go-bindata version a0ff2567cfb70903282db057e799fd826784d41d + git clone https://github.com/jteeuwen/go-bindata /tmp/tmp.NdftaLJucp/src/github.com/jteeuwen/go-bindata Install go-bindata version a0ff2567cfb70903282db057e799fd826784d41d Cloning into "/tmp/tmp.NdftaLJucp/src/github.com/jteeuwen/go-bindata"... + cd /tmp/tmp.NdftaLJucp/src/github.com/jteeuwen/go-bindata + git checkout -q a0ff2567cfb70903282db057e799fd826784d41d + go build -o /usr/local/bin/go-bindata github.com/jteeuwen/go-bindata/go-bindata + install_dockercli + echo Install docker/cli version 7230906e0e297999eb33da74e0279c5cf41a119e + git clone https://github.com/dperny/cli /tmp/tmp.NdftaLJucp/src/github.com/docker/cli Install docker/cli version 7230906e0e297999eb33da74e0279c5cf41a119e Cloning into "/tmp/tmp.NdftaLJucp/src/github.com/docker/cli"... + cd /tmp/tmp.NdftaLJucp/src/github.com/docker/cli + git checkout -q 7230906e0e297999eb33da74e0279c5cf41a119e + go build -o /usr/local/bin/docker github.com/docker/cli/cmd/docker + [ 1 -eq 1 ] + rm -rf /tmp/tmp.NdftaLJucp編譯docker源碼
clone moby
$ git clone https://github.com/moby/moby
創建一個分支:
$ git checkout dry-run-test
構建容器編譯:
$ make BIND_DIR=. shell
運行容器:
docker run --rm -i --privileged -e BUILDFLAGS -e KEEPBUNDLE -e DOCKER_BUILD_GOGC -e DOCKER_BUILD_PKGS -e DOCKER_CLIENTONLY -e DOCKER_DEBUG -e DOCKER_EXPERIMENTAL -e DOCKER_GITCOMMIT -e DOCKER_GRAPHDRIVER=devicemapper -e DOCKER_INCREMENTAL_BINARY -e DOCKER_REMAP_ROOT -e DOCKER_STORAGE_OPTS -e DOCKER_USERLANDPROXY -e TESTDIRS -e TESTFLAGS -e TIMEOUT -v "home/ubuntu/repos/docker/bundles:/go/src/github.com/moby/moby/bundles" -t "docker-dev:dry-run-test" bash root@f31fa223770f:/go/src/github.com/moby/moby#
我們啟動容器時小作修改使可以很方便的在本機上改代碼,在容器里構建:
docker run --rm -i --privileged -e BUILDFLAGS -e KEEPBUNDLE -e DOCKER_BUILD_GOGC -e DOCKER_BUILD_PKGS -e DOCKER_CLIENTONLY -e DOCKER_DEBUG -e DOCKER_EXPERIMENTAL -e DOCKER_GITCOMMIT -e DOCKER_GRAPHDRIVER=devicemapper -e DOCKER_INCREMENTAL_BINARY -e DOCKER_REMAP_ROOT -e DOCKER_STORAGE_OPTS -e DOCKER_USERLANDPROXY -e TESTDIRS -e TESTFLAGS -e TIMEOUT -v /Users/fanux/work/src/github.com:/go/src/github.com -t "docker-dev:dry-run-test" bash
容器內編譯源碼:
root@a8b2885ab900:/go/src/github.com/moby/moby# hack/make.sh binary ...output snipped... bundles/1.12.0-dev already exists. Removing. ---> Making bundle: binary (in bundles/1.12.0-dev/binary) Building: bundles/1.12.0-dev/binary/docker-1.12.0-dev Created binary: bundles/1.12.0-dev/binary/docker-1.12.0-dev Copying nested executables into bundles/1.12.0-dev/binary
拷貝bin文件:
root@a8b2885ab900:/go/src/github.com/moby/moby# cp bundles/1.12.0-dev/binary-client/docker* /usr/bin/ root@a8b2885ab900:/go/src/github.com/moby/moby# cp bundles/1.12.0-dev/binary-daemon/docker* /usr/bin/
啟動containerd:
root@a8b2885ab900:/go/src/github.com/docker/docker# dockerd -D & ...output snipped... DEBU[0001] Registering POST, /networks/{id:.*}/connect DEBU[0001] Registering POST, /networks/{id:.*}/disconnect DEBU[0001] Registering DELETE, /networks/{id:.*} INFO[0001] API listen on /var/run/docker.sock DEBU[0003] containerd connection state change: READY
這時你可以修改一些docker的代碼了,然后重新編譯即可,官方教程是修改了docker的代碼,而我更感興趣的是runc,下面就來改改runc試試。
修改runc代碼在容器內執行:
mkdir /mycontainer cd /mycontainer mkdir rootfs docker export $(docker create busybox) | tar -C rootfs -xvf - # 生成容器的配置文件config.json docker-runc spec docker-runc run mycontainerid
進到github.com/opencontainers/runc/run.go,修改代碼:
spec, err := setupSpec(context) fmt.Println("spec is: ", *spec)
再容器runc目錄構建runc:
make && make install
這時再到mycontainer目錄用我們構建的這個runc運行容器,我們打印的信息出來了。
root@7d8c68bba090:/go/src/github.com/opencontainers/mycontainer# runc run test spec is: {1.0.0-rc5 {linux amd64} {true {0 0} {0 0 [] } [sh] [PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin TERM=xterm] / 0xc42001a500 [{RLIMIT_NOFILE 1024 1024}] true } {rootfs true} runc [{/proc proc proc []} {/dev tmpfs tmpfs [nosuid strictatime mode=755 size=65536k]} {/dev/pts devpts devpts [nosuid noexec newinstance ptmxmode=0666 mode=0620 gid=5]} {/dev/shm tmpfs shm [nosuid noexec nodev mode=1777 size=65536k]} {/dev/mqueue mqueue mqueue [nosuid noexec nodev]} {/sys sysfs sysfs [nosuid noexec nodev ro]} {/sys/fs/cgroup cgroup cgroup [nosuid noexec nodev relatime ro]}]map[] 0xc420084380 } / #
更多問題聯系:https://github.com/fanux
文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。
轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/27047.html
摘要:接下來,我們來看一個更酷的工作流程,即通過引入來實現項目的持續集成。是一個持續集成發布平臺,支持對容器進行測試。取消對的選中狀態。 showImg(https://segmentfault.com/img/bVk4cF); 借助Docker,我們可以更容易地進行web應用部署,而同時不必頭疼于項目依賴、環境變量以及各種配置問題,Docker可以快捷、高效地處理好這一切。 而這也是本...
摘要:容器作為一類操作系統層面的虛擬化技術,其目標是在單一主機交付多套隔離性環境,容器共享同一套主機操作系統內核。與其它容器平臺不同,引入了一整套與容器管理相關的生態系統。每個容器都是相互隔離的保證安全的平臺。 導讀:本文章對Docker技術進行了介紹,闡述了Docker的技術發展歷程、容器與虛擬機的差異、Docker原理、特點、Docker三組件和Docker帶來的影響,為我們進一步理解D...
摘要:在谷歌不是這樣,谷歌不會把特定的應用裝在某臺服務器上,業務應用和服務器的強綁定對于谷歌這種量級的數據中心的維護難度太高了。但是金融機構的數據中心規模不像谷歌這么大,所以能做到業務應用和硬件的強綁定。 復雜的基礎IT架構是傳統金融的現狀,如何快速響應用戶需求,加快新業務上線速度,縮短產品的迭代周期? 數人云在容器落地金融云的2年實踐中,實現金融核心業務技術WebLogic、J2EE、Or...
摘要:容器云架構方案。容器云架構方案基于容器技術,運維技術團隊開發了五阿哥網站的容器云平臺。多云對接私有云和公有云進行統一托管,包含網絡區域配置,實例開通及的環境初始化配置等。技術選型及實踐鏡像標準眾所周知,的鏡像是分層的。 前言 五阿哥鋼鐵電商平臺(www.wuage.com)是由鋼鐵行業第一的中國五礦與互聯網第一的阿里巴巴聯手打造,并充分運用雙方股東優勢資源,即:阿里巴巴在大數據、電商運...
摘要:關注的目標就是在代碼提交之后,順利且迅速的把新的功能部署到產品環境上。由于是,那么單元測試,回歸測試,集成測試,都是實現的手段。高質量的產品需求書和高質量的自動化集成測試用例毫無疑問,是高質量軟件的保證之一。 showImg(https://segmentfault.com/img/remote/1460000006877091?w=800&h=600); 什么是Test-Driven...
摘要:本文首發于深入淺出區塊鏈社區原文鏈接聯盟鏈初識以及環境搭建流程原文已更新,請讀者前往原文閱讀這篇文章首先簡單介紹了聯盟鏈是什么,再詳細的介紹了環境搭建的整個流程。 本文首發于深入淺出區塊鏈社區原文鏈接:聯盟鏈初識以及Fabric環境搭建流程原文已更新,請讀者前往原文閱讀 這篇文章首先簡單介紹了聯盟鏈是什么,再詳細的介紹了Fabric環境搭建的整個流程。 區塊鏈分類: 以參與方式分類,區...
閱讀 2804·2021-11-19 11:35
閱讀 2582·2021-11-02 14:40
閱讀 1396·2021-09-04 16:48
閱讀 3009·2019-08-30 15:55
閱讀 1753·2019-08-30 13:11
閱讀 1956·2019-08-29 11:12
閱讀 1088·2019-08-27 10:52
閱讀 3157·2019-08-26 18:36