Docker Cookbook



Download 6,31 Mb.
Pdf ko'rish
bet108/260
Sana21.04.2022
Hajmi6,31 Mb.
#570749
1   ...   104   105   106   107   108   109   110   111   ...   260
Bog'liq
Docker Cookbook

or
"license"
for
more
information
.
>>>
from
docker
import
Client
>>>
c
=
Client
(
base_url
=
"tcp://127.0.0.1:2375"
)
>>>
c
.
containers
()
[]
You can explore the methods available via 
docker-py
by using 
help(c)
at the Python
prompt in the interactive sessions.
Discussion
The 
docker-py
 module has a few basics 
documented
. Of note is the integration with
Boot2Docker (
Recipe 1.7
), which has a helper function to set up the 
connection
.
Since the latest Boot2Docker uses TLS for added security in accessing the Docker
daemon, the setup is slightly different than what we presented. In addition, there is
currently a bug that is worth mentioning for those who will be interested in testing
docker-py
.
124 | Chapter 4: Docker Configuration and Development


Start Boot2Docker:
$ boot2docker start
Waiting for VM and Docker daemon to start...
................oooo
Started.
Writing /Users/sebgoa/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/sebgoa/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/sebgoa/.boot2docker/certs/boot2docker-vm/key.pem
To connect the Docker client to the Docker daemon, please set:
export DOCKER_HOST=tcp://192.168.59.103:2376
export DOCKER_CERT_PATH=/Users/sebgoa/.boot2docker/certs/boot2docker-vm
export DOCKER_TLS_VERIFY=1
This returns a set of environment variables that need to be set. Boot2Docker provides
a nice convenience utility
$(boot2docker shellinit)
, to set everything up. How‐
ever, for 
docker-py
to work, you need to edit your 
/etc/hosts
file and set a different
DOCKER_HOST
. In 
/etc/hosts
add a line with the IP of 
boot2docker
and its local DNS
name (i.e., 
boot2docker
) and then 
export DOCKER_HOST=tcp://boot2docker:2376
.
Then in a Python interactive shell:
>>>

Download 6,31 Mb.

Do'stlaringiz bilan baham:
1   ...   104   105   106   107   108   109   110   111   ...   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