Docker Cookbook


Compiling Your Own Docker Binary from Source



Download 6,31 Mb.
Pdf ko'rish
bet96/260
Sana21.04.2022
Hajmi6,31 Mb.
#570749
1   ...   92   93   94   95   96   97   98   99   ...   260
Bog'liq
Docker Cookbook

4.2 Compiling Your Own Docker Binary from Source
Problem
You would like to develop the Docker software and build your own Docker binary.
Solution
Use Git to clone the Docker repository from 
GitHub
and use a Makefile to create
your own binary.
Docker is built within a Docker container. In a Docker host, you can clone the
Docker repository and use the Makefile rules to build a new binary. This binary is
obtained by running a privileged Docker container. The Makefile contains several
targets, including a 
binary
target:
$ cat Makefile
...
default: binary
all: build
$(DOCKER_RUN_DOCKER) hack/make.sh
4.2 Compiling Your Own Docker Binary from Source | 109


binary: build
$(DOCKER_RUN_DOCKER) hack/make.sh binary
...
Therefore, it is as easy as 
sudo make binary
:
The 
hack
directory in the root of the Docker repository has been
moved to the 
project
directory. Therefore, the 
make.sh
script is in
fact at 
project/make.sh
. It uses scripts for each bundle that are
stored in the 
project/make/
directory.
$ sudo make binary
...
docker run --rm -it --privileged \
-e BUILDFLAGS -e DOCKER_CLIENTONLY -e DOCKER_EXECDRIVER \
-e DOCKER_GRAPHDRIVER -e TESTDIRS -e TESTFLAGS \
-e TIMEOUT \
-v "/tmp/docker/bundles:/go/src/github.com/docker/docker/\
bundles" \
"docker:master" hack/make.sh binary
---> Making bundle: binary (in bundles/1.9.0.-dev/binary)
Created binary: \
/go/src/github.com/docker/docker/bundles/1.9.0-dev/binary/docker-1.9.0-dev
You see that the 
binary
target of the Makefile will launch a privileged Docker con‐
tainer from the 
docker:master
image, with a set of environment variables, a volume
mount, and a call to the 
hack/make.sh binary
command.
With the current state of Docker development, the new binary will be located in the
bundles/1.9.0-dev/binary/
directory. The version number might differ, depending on
the state of Docker releases.
Discussion
To ease this process, you can clone the repository that accompanies this cookbook. A
Vagrantfile is provided that starts an Ubuntu 14.04 virtual machine, installs the latest
stable Docker release, and clones the Docker repository:
$ git clone https://github.com/how2dock/docbook
$ cd docbook/ch04/compile/
$ vagrant up
Once the machine is up, 
ssh
to it and go to the 
/tmp/docker
directory, which should
have been created during the Vagrant provisioning process. Then run 
make
. The first
time you run the Makefile, the stable Docker version installed on the machine will
pull the base image being used by the Docker build process 
ubuntu:14.04
, and then

Download 6,31 Mb.

Do'stlaringiz bilan baham:
1   ...   92   93   94   95   96   97   98   99   ...   260




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish