Docker Cookbook


Networking Containers on Multiple Hosts with Docker Network | 101



Download 6,31 Mb.
Pdf ko'rish
bet91/260
Sana21.04.2022
Hajmi6,31 Mb.
#570749
1   ...   87   88   89   90   91   92   93   94   ...   260
Bog'liq
Docker Cookbook

3.14 Networking Containers on Multiple Hosts with Docker Network | 101


$ docker service ls
SERVICE ID NAME NETWORK CONTAINER
Start a container and check the content of 
/etc/hosts
:
$ docker run -it --rm ubuntu:14.04 bash
root@df479e660658:/# cat /etc/hosts
172.21.0.3 
df479e660658
127.0.0.1 
localhost
::1 
localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.21.0.3 
distracted_bohr
172.21.0.3 
distracted_bohr.multihost
In a separate terminal on 
net-1
, list the networks again. You will see that the 
multi
host
overlay now appears. The overlay network 
multihost
is your default network.
This was set up by the Docker daemon during the Vagrant provisioning. Check 
/etc/
default/docker
to see the options that were set:
vagrant@net-1:~$ docker network ls
NETWORK ID NAME TYPE
4275f8b3a821 none null
80eba28ed4a7 host host
64322973b4aa bridge bridge
b5c9f05f1f8f multihost overlay
Now in a separate terminal, 
ssh
to 
net-2
, and check the network and services. The
networks will be the same, and the default network will also be 
multihost
of type
overlay
. But the service will show the container started on 
net-1
:
$ vagrant ssh net-2
vagrant@net-2:~$ docker service ls
SERVICE ID NAME NETWORK CONTAINER
b00f2bfd81ac distracted_bohr multihost df479e660658
Start a container on 
net-2
and check 
/etc/hosts
:
vagrant@net-2:~$ docker run -ti --rm ubuntu:14.04 bash
root@2ac726b4ce60:/# cat /etc/hosts
172.21.0.4 
2ac726b4ce60
127.0.0.1 
localhost
::1 
localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.21.0.3 
distracted_bohr
172.21.0.3 
distracted_bohr.multihost
172.21.0.4 
modest_curie
172.21.0.4 
modest_curie.multihost

Download 6,31 Mb.

Do'stlaringiz bilan baham:
1   ...   87   88   89   90   91   92   93   94   ...   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