Docker Cookbook


| Chapter 3: Docker Networking



Download 6,31 Mb.
Pdf ko'rish
bet79/260
Sana21.04.2022
Hajmi6,31 Mb.
#570749
1   ...   75   76   77   78   79   80   81   82   ...   260
Bog'liq
Docker Cookbook

86 | Chapter 3: Docker Networking


interface pairs. These pairs act as a pipe, with one end of the pipe in the container
namespace and the other end on the bridge that you just created on the host.
Therefore, let’s create a 
veth
pair 
foo, bar
and attach 
foo
to the bridge 
br0
:
$ sudo ip link add foo type veth peer name bar
$ sudo brctl addif br0 foo
$ sudo ip link set foo up
The result can be seen with 
ip -d link show
; a new bridge 
br0
and 
foo
interface of
type 
veth
attached to it:
$ ip -d link
1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT \
group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 promiscuity 0
2: eth0: mtu 1500 qdisc pfifo_fast state \
UNKNOWN mode DEFAULT group default qlen 1000
link/ether 08:00:27:98:a7:ad brd ff:ff:ff:ff:ff:ff promiscuity 0
3: docker0: mtu 1500 qdisc noqueue state \
DOWN mode DEFAULT group default
link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff promiscuity 0
bridge
6: br0: mtu 1500 qdisc noqueue state UP mode \
DEFAULT group default
link/ether ee:7d:7e:f7:6f:18 brd ff:ff:ff:ff:ff:ff promiscuity 0
bridge
8: foo: mtu 1500 qdisc pfifo_fast master br0 \
state UP mode DEFAULT group default qlen 1000
link/ether ee:7d:7e:f7:6f:18 brd ff:ff:ff:ff:ff:ff promiscuity 1
veth
$ brctl show
bridge name 
bridge id 
STP enabled 
interfaces
br0 
8000.ee7d7ef76f18 
no 
foo
docker0
8000.000000000000 
not
Do not call each end of your veth pair the traditional 
eth0
or 
eth1
as it could conflict with existing physical interfaces on the host.
To complicate things a bit, when you started your container with 
--net=none
, it did
create a network namespace but there was nothing in it except the loopback device.
Now that you want to configure it (e.g., adding an interface, setting up a route), you
need to find the network namespace ID. Docker keeps its network namespaces
in 
/var/run/docker/netns
, which is a nondefault location. To be able to use the 
ip
tool
properly, you are going to do a little nonconventional hack and symlink 
/var/run/
docker/netns
to 
/var/run/netns
, which is the default location where the 
ip
tool looks

Download 6,31 Mb.

Do'stlaringiz bilan baham:
1   ...   75   76   77   78   79   80   81   82   ...   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