Docker Cookbook



Download 6,31 Mb.
Pdf ko'rish
bet102/260
Sana21.04.2022
Hajmi6,31 Mb.
#570749
1   ...   98   99   100   101   102   103   104   105   ...   260
Bog'liq
Docker Cookbook

Solution
Switch the listening protocol that the Docker daemon is using by editing the configu‐
ration file in 
/etc/default/docker
and issue a remote API call.
In 
/etc/default/docker
, add a line that sets 
DOCKER_HOST
to use 
tcp
on port 2375. Then
restart the Docker daemon with 
sudo service docker restart
:
$ cat /etc/default/docker
...
# Use DOCKER_OPTS to modify the daemon startup options.
#DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"
DOCKER_OPTS="-H tcp://127.0.0.1:2375"
...
You will then be able to use the Docker client by specifying a host accessed using
TCP:
$ docker -H tcp://127.0.0.1:2375 images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
ubuntu 14.04 04c5d3b7b065 6 days ago 192.7 MB
This method is unencrypted and unauthenticated. You should not
use this on a publicly routable host. This would expose your
Docker daemon to anyone. You will need to properly secure your
Docker daemon if you want to do this in production. (See 
Recipe
4.9
.)
Discussion
With the Docker daemon listening over TCP you can now use 
curl
to make API calls
and explore the response. This is a good way to learn the Docker remote API:
$ curl -s http://127.0.0.1:2375/images/json | python -m json.tool
[
{
"Created": 1418673175,
"Id": "04c5d3b7b0656168630d3ba35d8889bdaafcaeb32bfbc47e7c5d35d2",
"ParentId": "d735006ad9c1b1563e021d7a4fecfd384e2a1c42e78d8261b83d6271",
"RepoTags": [
"ubuntu:14.04"
118 | Chapter 4: Docker Configuration and Development


],
"Size": 0,
"VirtualSize": 192676726
}
]
We pipe the output of the 
curl
command through 
python -m json.tool
to make
the JSON object that is returned readable. And the 
-s
option removes the informa‐
tion of the data transfer.

Download 6,31 Mb.

Do'stlaringiz bilan baham:
1   ...   98   99   100   101   102   103   104   105   ...   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