๐ŸŒฑ Infra/Container_Docker

[Docker-Basic (5)] Container Network

mini_world 2020. 9. 28. 15:23
๋ชฉ์ฐจ ์ ‘๊ธฐ

 

์ปจํ…Œ์ด๋„ˆ์˜ ๋„คํŠธ์›Œํฌ์— ๋Œ€ํ•ด์„œ ์•Œ์•„๋ณด๊ณ , ์‹ค์Šตํ•ด๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.


 

Docker Network ๋Š” ๋ธŒ๋ฆฌ์ง€(Bridge),ํ˜ธ์ŠคํŠธ(host), ์ปจํ…Œ์ด๋„ˆ(container), ๋…ผ(none) ์ด๋ ‡๊ฒŒ 4๊ฐ€์ง€๋กœ ๊ตฌ๋ถ„๋ฉ๋‹ˆ๋‹ค.
์•„๋ž˜ 3๊ฐ€์ง€ ๋ฐฉ์‹๋งŒ ๋ณด์ด๋Š”๋ฐ, ์ปจํ…Œ์ด๋„ˆ ๋ฐฉ์‹์€ ๋ณ„๋„๋กœ ๋“œ๋ผ์ด๋ฒ„๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ธฐ๋•Œ๋ฌธ์— ๋‚˜์˜ค์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

[root@docker /]# docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
103b63dc3b48        bridge              bridge              local
db3d9f5b68d6        host                host                local
3a8a3fc8dbd7        none                null                local

 

๊ฐ ์‹ค์Šต์„ ํ†ตํ•ด ์–ด๋–ป๊ฒŒ ๋‹ค๋ฅธ์ง€ ์•Œ์•„๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.


 

1. Docker Network - Bridge

docker์˜ ๊ธฐ๋ณธ ๋„คํŠธ์›Œํฌ ์˜ต์…˜์€ Bridge์ž…๋‹ˆ๋‹ค. 
์ปจํ…Œ์ด๋„ˆ๊ฐ€ ์ƒ์„ฑ๋˜๋ฉด ๊ฐ ์ปจํ…Œ์ด๋„ˆ๋งˆ๋‹ค ๊ณ ์œ ํ•œ Network Namespace ์˜์—ญ์ด ์ƒ์„ฑ๋˜๋ฉฐ,
docker0 bridge์— ์ปจํ…Œ์ด๋„ˆ์˜ ์ธํ„ฐํŽ˜์ด์Šค๊ฐ€ ํ•˜๋‚˜์”ฉ ๋ฐ”์ธ๋”ฉ ๋˜๋Š” ๊ตฌ์กฐ์ž…๋‹ˆ๋‹ค.

1-1) ๋ธŒ๋ฆฟ์ง€ ๋„คํŠธ์›Œํฌ ์ƒ์„ฑ

์ด๋ฒˆ ๋‹จ๊ณ„์—์„œ๋Š” ๋ธŒ๋ฆฟ์ง€ ๋„คํŠธ์›Œํฌ๋ฅผ ์ƒ์„ฑํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. :)

๋ธŒ๋ฆฟ์ง€ ๋„คํŠธ์›Œํฌ ์ƒ์„ฑํ• ๋•Œ ๋„ฃ์–ด์ฃผ๋Š” ์˜ต์…˜์ž…๋‹ˆ๋‹ค.
--driver: ๋„คํŠธ์›Œํฌ ๊ด€๋ฆฌ ๋“œ๋ผ์ด๋ฒ„ 
--subnet: ๋„คํŠธ์›Œํฌ ๋ฒ”์œ„ CIDR
--ip-range: ์ปจํ…Œ์ด๋„ˆ์— ํ• ๋‹น๋  ์‹ค์ œ IP์ฃผ์†Œ ๋ฒ”์œ„
--gateway: ์„œ๋ธŒ๋„ท ๊ฒŒ์ดํŠธ์›จ์ด ์ง€์ • (๋ณ„๋„๋กœ ์ง€์ •ํ•˜์ง€ ์•Š์„์‹œ ์ž„์˜๋กœ ์ง€์ •)

[root@docker /]# docker network create --driver bridge --subnet=10.0.0.0/16 --ip-range=10.0.1.0/24 --gateway=10.0.1.1 vswitch01
5b89ca2c84aca4adaac7d687735ac835829f30117290e813e714d9e22f18e3a9

Docker Network ๋ช…๋ น์–ด๋กœ ๋„คํŠธ์›Œํฌ ๊ตฌ์„ฑ ์ •๋ณด๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค. ๋ฐฉ๊ธˆ ์ƒ์„ฑํ•œ vswitch01 ๋„คํŠธ์›Œํฌ๊ฐ€ ๋ณด์ด๋„ค์š”.

[root@docker /]# docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
103b63dc3b48        bridge              bridge              local
db3d9f5b68d6        host                host                local
3a8a3fc8dbd7        none                null                local
5b89ca2c84ac        vswitch01           bridge              local

 

2-2) ๋ธŒ๋ฆฟ์ง€ ๋„คํŠธ์›Œํฌ ์‹ค์Šต

๋จผ์ € ์‹ค์Šต์šฉ๋„์˜ ๋„์ปค ์ปจํ…Œ์ด๋„ˆ Centos1, Centos2๋ฅผ ์ƒ์„ฑํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

[root@docker /]# docker run --name centos1 --hostname centos1 --network vswitch01 -itd centos
a373e969465d70a86d6ff0fc71f59b95a211db2c38e7c14ff43cf70594085d0b

[root@docker /]# docker run --name centos2 --hostname centos2 --network vswitch01 -itd centos
23c5e5260ea08a12377fd8cfee14deaacc9be47ba42073510c3328a5bb873cfd

Centos1 ์ปจํ…Œ์ด๋„ˆ์— ์ ‘์†ํ•ด์„œ ํ†ต์‹  ํ…Œ์ŠคํŠธ๋ฅผ ์ง„ํ–‰ํ•ด๋ด…์‹œ๋‹ค.

๋จผ์ €, centos1 ์ปจํ…Œ์ด๋„ˆ์— ์ ‘์†ํ•ฉ๋‹ˆ๋‹ค.

[root@docker /]# docker exec -it centos1 /bin/bash

์ด์ œ ip a ๋ช…๋ น์–ด๋กœ ๋„คํŠธ์›Œํฌ ์ •๋ณด๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.  10.0.1.0 IP๊ฐ€ ํ• ๋‹น๋˜์—ˆ๋„ค์š”.

[root@centos1 /]# ip a   
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
25: eth0@if26: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:0a:00:01:00 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 10.0.1.0/16 brd 10.0.255.255 scope global eth0
       valid_lft forever preferred_lft forever

ping ์œผ๋กœ centos2 ์ปจํ…Œ์ด๋„ˆ์™€ ํ†ต์‹ ์ด ๋˜๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.
์ž˜๋˜๋„ค์š” :)

[root@centos1 /]# ping -c3 centos2
PING centos2 (10.0.1.2) 56(84) bytes of data.
64 bytes from centos2.vswitch01 (10.0.1.2): icmp_seq=1 ttl=64 time=0.084 ms
64 bytes from centos2.vswitch01 (10.0.1.2): icmp_seq=2 ttl=64 time=0.061 ms
64 bytes from centos2.vswitch01 (10.0.1.2): icmp_seq=3 ttl=64 time=0.053 ms

--- centos2 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.053/0.066/0.084/0.013 ms

[root@centos1 /]# exit

 

์ด๋ฒˆ์—๋Š” centos2 ์ปจํ…Œ์ด๋„ˆ์— ์ ‘์†ํ•ฉ๋‹ˆ๋‹ค.

[root@docker /]# docker exec -it centos2 /bin/bash

๋งˆ์ฐฌ๊ฐ€์ง€๋กœ, Centos2 ์ปจํ…Œ์ด๋„ˆ์— ์„ค์ •๋œ ๋„คํŠธ์›Œํฌ๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค. 10.0.1.2 IP๊ฐ€ ํ• ๋‹น๋˜์—ˆ์Šต๋‹ˆ๋‹ค :)

[root@centos2 /]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
27: eth0@if28: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:0a:00:01:02 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 10.0.1.2/16 brd 10.0.255.255 scope global eth0
       valid_lft forever preferred_lft forever

์ด์ œ centos1 ์ปจํ…Œ์ด๋„ˆ์™€ ํ†ต์‹ ์ด ์ž˜ ๋˜๋Š”์ง€ ํ™•์ธํ•ด๋ด…๋‹ˆ๋‹ค.
๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ์•„์ฃผ ์ž˜ ๋˜๋„ค์š” :)

[root@centos2 /]# ping -c3 centos1
PING centos1 (10.0.1.0) 56(84) bytes of data.
64 bytes from centos1.vswitch01 (10.0.1.0): icmp_seq=1 ttl=64 time=0.049 ms
64 bytes from centos1.vswitch01 (10.0.1.0): icmp_seq=2 ttl=64 time=0.051 ms
64 bytes from centos1.vswitch01 (10.0.1.0): icmp_seq=3 ttl=64 time=0.045 ms

--- centos1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2ms
rtt min/avg/max/mdev = 0.045/0.048/0.051/0.006 ms

[root@centos2 /]# exit

 

 

2. Docker Network - Host

Host๋ฐฉ์‹์€ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์‹ค์ƒํ• ๋•Œ Host์˜ ๋„คํŠธ์›Œํฌ๋ฅผ ๊ฐ™์ด ์‚ฌ์šฉํ•˜๋„๋ก ํ•˜๋Š” ์˜ต์…˜์ž…๋‹ˆ๋‹ค.
์ด๋ ‡๊ฒŒ ์„ค์ •ํ•˜๋ฉด ์ปจํ…Œ์ด๋„ˆ๋Š” ๋…๋ฆฝ์ ์ธ ๋„คํŠธ์›Œํฌ์˜์—ญ์„ ๊ฐ–์ง€ ์•Š๊ณ  ํ˜ธ์ŠคํŠธ์˜ ๋„คํŠธ์›Œํฌ๋ฅผ ๊ณต์œ ํ•˜์—ฌ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
๋ฐ”๋กœ ํ…Œ์ŠคํŠธ ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

๋จผ์ €, network host ๋ฐฉ์‹์œผ๋กœ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

[root@docker /]# docker run --name centos3 --hostname cent3 --network host -itd centos
11993b72216806d73a0333c0d241070f26c7a1b0a91ceacdc880686cfce7c5ce

์ปจํ…Œ์ด๋„ˆ ๋ชฉ๋ก์„ ํ™•์ธํ•˜์—ฌ ์ž˜ ์ƒ์„ฑ๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

[root@docker /]# docker container ls -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
11993b722168        centos              "/bin/bash"         10 seconds ago      Up 10 seconds                           centos3
23c5e5260ea0        centos              "/bin/bash"         8 minutes ago       Up 8 minutes                            centos2
a373e969465d        centos              "/bin/bash"         8 minutes ago       Up 8 minutes                            centos1

์ปจํ…Œ์ด๋„ˆ์— ip a ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰์‹œ์ผœ ์ถœ๋ ฅ ๋‚ด์šฉ์„ ์‚ดํŽด๋ด…๋‹ˆ๋‹ค. ํ˜ธ์ŠคํŠธ์ปดํ“จํ„ฐ์™€ ์„ค์ • ๋‚ด์šฉ์ด ๊ฐ™์Šต๋‹ˆ๋‹ค :)

[root@docker /]# docker exec -it centos3 ip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc mq state UP group default qlen 1000
    link/ether 02:c2:72:d9:ee:7c brd ff:ff:ff:ff:ff:ff
    inet 172.31.3.201/20 brd 172.31.15.255 scope global dynamic ens5
       valid_lft 2840sec preferred_lft 2840sec
    inet6 fe80::c2:72ff:fed9:ee7c/64 scope link 
       valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:6e:fa:50:8e brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever
    inet6 fe80::42:6eff:fefa:508e/64 scope link 
       valid_lft forever preferred_lft forever
22: br-5b89ca2c84ac: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:93:30:94:f3 brd ff:ff:ff:ff:ff:ff
    inet 10.0.1.1/16 brd 10.0.255.255 scope global br-5b89ca2c84ac
       valid_lft forever preferred_lft forever
    inet6 fe80::42:93ff:fe30:94f3/64 scope link 
       valid_lft forever preferred_lft forever
26: vethd7504ec@if25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-5b89ca2c84ac state UP group default 
    link/ether 72:39:41:ba:d2:38 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet6 fe80::7039:41ff:feba:d238/64 scope link 
       valid_lft forever preferred_lft forever
28: veth8f37b6f@if27: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-5b89ca2c84ac state UP group default 
    link/ether 72:2d:e5:33:45:9f brd ff:ff:ff:ff:ff:ff link-netnsid 1
    inet6 fe80::702d:e5ff:fe33:459f/64 scope link 
       valid_lft forever preferred_lft forever

์™ธ๋ถ€ ๋„คํŠธ์›Œํฌ ์—ฐ๊ฒฐ๋„ ์ž˜ ๋˜๋Š”์ง€ ํ™•์ธํ•ด๋ด…๋‹ˆ๋‹ค. 

[root@docker /]# docker exec -it centos3 ping -c3 8.8.8.8

PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=106 time=30.1 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=106 time=30.1 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=106 time=30.1 ms

--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 4ms
rtt min/avg/max/mdev = 30.127/30.132/30.138/0.141 ms

docker inspect ๋ช…๋ น์–ด๋ฅผ ์ด์šฉํ•˜์—ฌ host ๋„คํŠธ์›Œํฌ๋ฅผ ํ™•์ธํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.
๋ช…๋ น์–ด ์ถœ๋ ฅ๊ฒฐ๊ณผ์—  "Containers" Centos3์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค :)

[root@docker /]# docker network inspect host
[
    {
        "Name": "host",
        "Id": "db3d9f5b68d68428cc20015039a324e3929aa928dc3ddf50488b02e827d91efc",
        "Created": "2020-09-28T02:21:10.637717387Z",
        "Scope": "local",
        "Driver": "host",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": []
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "11993b72216806d73a0333c0d241070f26c7a1b0a91ceacdc880686cfce7c5ce": {
                "Name": "centos3",
                "EndpointID": "468e3ffa63589a1dfa5a3f98cbc2f55797cdc6f97ee9045bc4ab882127032e9f",
                "MacAddress": "",
                "IPv4Address": "",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {}
    }
]

 

3. Docker Network - Container

๊ธฐ์กด ์กด์žฌํ•˜๋Š” ์ปจํ…Œ์ด๋„ˆ์˜ ๋„คํŠธ์›Œํฌ ํ™˜๊ฒฝ์„ ๊ณต์œ ํ•˜๋Š” ์˜ต์…˜์ž…๋‹ˆ๋‹ค.

๋ฐ”๋กœ ์‹ค์Šต ์ง„ํ–‰ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.
์ผ๋‹จ, ์ปจํ…Œ์ด๋„ˆ์˜ ๋ชฉ๋ก์„ ํ™•์ธํ•ด๋ด…๋‹ˆ๋‹ค.

[root@docker /]# docker container ls -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
11993b722168        centos              "/bin/bash"         5 minutes ago       Up 5 minutes                            centos3
23c5e5260ea0        centos              "/bin/bash"         14 minutes ago      Up 14 minutes                           centos2
a373e969465d        centos              "/bin/bash"         14 minutes ago      Up 14 minutes                           centos1

์ปจํ…Œ์ด๋„ˆ ๋„คํŠธ์›Œํฌ ์˜ต์…˜( --net=container:<์ปจํ…Œ์ด๋„ˆID>)์„ ์ฃผ๊ณ , ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.
์—ฌ๊ธฐ์—์„œ๋Š” centos4 ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์‹คํ–‰์‹œํ‚ค๋ฉด์„œ, centos1 ์ปจํ…Œ์ด๋„ˆ์˜ ๋„คํŠธ์›Œํฌ๋ฅผ ์“ฐ๊ฒ ๋‹ค๊ณ  ์˜ต์…˜์„ ๋„ฃ์–ด์คฌ์Šต๋‹ˆ๋‹ค.

[root@docker /]# docker run --name centos4 --net=container:a373e969465d -dit centos
20ff7f9ff27049e4596bf4bfb2242935386f28f3f8380f031b44fb38688a43c3

์ƒˆ๋กœ ์ƒ์„ฑํ•œ ์ปจํ…Œ์ด๋„ˆ centos4 ์˜ ๋„คํŠธ์›Œํฌ ์„ค์ •์„ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค. Centos4์— ์„ค์ •๋œ IP๊ฐ€ Centos1์˜ IP์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค.

[root@docker /]# docker exec -it centos4 ip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever

25: eth0@if26: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:0a:00:01:00 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 10.0.1.0/16 brd 10.0.255.255 scope global eth0
       valid_lft forever preferred_lft forever

inspect  ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ํ™•์ธํ•ด๋ณด๋ฉด, centos4์ปจํ…Œ์ด๋„ˆ๋Š” ๋‹ค๋ฅธ ์ปจํ…Œ์ด๋„ˆ์˜ ๋„คํŠธ์›Œํฌ๋ฅผ ๊ณต์œ ํ•˜๋ฏ€๋กœ ๋„คํŠธ์›Œํฌ ์„ค์ •์ด ์—†์Šต๋‹ˆ๋‹ค.

[root@docker /]# docker container inspect centos4
.. ์ƒ๋žต..
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {},
            "SandboxKey": "",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "MacAddress": "",
            "Networks": {}
        }
.. ์ƒ๋žต..

 

 

4. Docker Network - None

None Network ์˜ต์…˜์œผ๋กœ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ƒ์„ฑํ•˜๋ฉด, ๊ฒฉ๋ฆฌ๋œ ์ปจํ…Œ์ด๋„ˆ๊ฐ€ ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.
lookback์ธํ„ฐํŽ˜์ด์Šค๋งŒ ๊ฐ€์ง€๋ฉฐ, ํ†ต์‹ ์„ ์œ„ํ•œ ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ๊ฐ€์ง€์ง€ ์•Š์œผ๋ฉฐ, ์™ธ๋ถ€ ํ†ต์‹ ์ด ๋ถˆ๊ฐ€๋Šฅํ•œ ์ƒํƒœ์ž…๋‹ˆ๋‹ค.

none ๋„คํŠธ์›Œํฌ๋กœ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

[root@docker /]# docker run --name centos5 --net=none -dit centos
cb3738c93d86a6d24ed014ee85181a7917cc59102d27075714364ac0e6054b57

์ปจํ…Œ์ด๋„ˆ์˜ ๋„คํŠธ์›Œํฌ ์„ค์ •์ •๋ณด ํ™•์ธ ์‹œ loopback ๋„คํŠธ์›Œํฌ ์™ธ ๋‹ค๋ฅธ ๋„คํŠธ์›Œํฌ๋Š” ์„ค์ •๋˜์–ด์žˆ์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

[root@docker /]# docker exec -it centos5 ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
[root@docker /]# 

 

 

๊ณ ์ƒํ•˜์…จ์Šต๋‹ˆ๋‹ค :)

728x90