Docker Cookbook


| Chapter 7: The Docker Ecosystem: Tools



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

226 | Chapter 7: The Docker Ecosystem: Tools


gliderlabs/registrator
-ip 192.168.33.10
etcd://192.168.33.10:4001/cookbook
You define the registry service backend as an argument to the 
gli‐
derlabs/registrator
image. Do not forget the name of the directory
that you created with 
etcdctl
. It completes the URI of your back‐
end endpoint.
Replace 
192.168.33.10
with the IP address of your own setup. In
this example, I ran everything on the same host. But you will most
likely want to run an 
etcd
cluster separate from your cluster of
Docker hosts where you will run registrator.
You can now start any container, expose ports to the host, and you will see the regis‐
tration in your 
etcd
key-value store:
$ docker run -d -p 80:80 nginx
$ ./etcdctl ls /cookbook
/cookbook/nginx-80
$ ./etcdctl ls /cookbook/nginx-80
/cookbook/nginx-80/192.168.33.10:pensive_franklin:80
$ ./etcdctl get /cookbook/nginx-80/192.168.33.10:pensive_franklin:80
192.168.33.10:80
If you look at the logs of the registrator container, you will see that it is listening to
Docker events and registering the ports exposed to the host:
$ docker logs
2015/03/26 ... registrator: Forcing host IP to 192.168.33.10
2015/03/26 ... registrator: Using etcd registry backend at \
etcd://192.168.33.10:4001/cookbook
2015/03/26 ... registrator: ignored: 6f8043d9973f no published ports
2015/03/26 ... registrator: Listening for Docker events...
2015/03/26 ... registrator: ignored 8c033ca03a82 port 443 not published on host
2015/03/26 ... registrator: added: 8c033ca03a82 192.168.33.10:pensive_franklin:80
In these logs, 
6f8043d9973f
is the container ID of the registrator container, and
8c033ca03a82
is the container ID of the Nginx container that you started.
Discussion
The naming convention for the keys stored in 
etcd
is based on the 
Service
object
created by registrator and passed to the registry backend. From the 
GitHub repo
, the
Service
structure is defined like this:
type Service struct {
ID string // ::

Download 6,31 Mb.

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