Docker Cookbook


Discovering Docker Services with Registrator | 227



Download 6,31 Mb.
Pdf ko'rish
bet183/260
Sana21.04.2022
Hajmi6,31 Mb.
#570749
1   ...   179   180   181   182   183   184   185   186   ...   260
Bog'liq
Docker Cookbook

7.13 Discovering Docker Services with Registrator | 227


//[:udp if udp]
Name string //
//[- if >1 published ports]
Port int //
IP string // || if 0.0.0.0
Tags []string // empty, or includes 'udp' if udp
Attrs map[string]string // any remaining service metadata from environment
}
The key for the service is defined by the following:
//
In this example, it is then (see the ID definition in the 
Service
object):
cookbook/nginx-80/192.168.33.10:pensive_franklin:80
and set to 
:
or in this example 
192.168.33.10:80
(see the Port and IP
definitions in the 
Service
object).
If you do not want to use 
etcd
but rather use 
consul
, you can switch the registry
backend. You can easily try this on a single host, by using the 
progrium/consul
image
from Docker Hub. Pull the image and run the 
consul
agent in one terminal session
(the Consul container is not detached in this example):
$ docker pull progrium/consul
$ docker run -p 8400:8400 -p 8500:8500 -p 8600:53/udp
-h cookbook progrium/consul -server
-bootstrap -ui-dir /ui
In another session, start 
registrator
but change the registry URI to 
consul://
192.168.33.10:8500/foobar
:
$ docker run -d -v /var/run/docker.sock:/tmp/docker.sock
-h 192.168.33.10 gliderlabs/registrator
-ip 192.168.33.10 consul://192.168.33.10:8500/foobar
You can now start an Nginx container:
$ docker run -d -p 80:80 nginx
And now, if you check the Consul UI at 
http://192.168.33.10:8500/ui
, you will
see that a 
foobar
directory has been created with several keys in them: the keys for the
Consul container itself and the key for your Nginx container. See 
Figure 7-9
.

Download 6,31 Mb.

Do'stlaringiz bilan baham:
1   ...   179   180   181   182   183   184   185   186   ...   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