choi3179 / docker-nginx-vhost

0 stars 0 forks source link

[실습] 포트번호 1개만 사용하여 vhost 환경 구현 #4

Closed choi3179 closed 8 months ago

choi3179 commented 8 months ago

기존 환경

choi3179 commented 8 months ago

수정

이미지 생성

컨테이너 생성

$ docker run --name serv-a -d choi3179/vhost-serv-a
$ docker run --name serv-b -d choi3179/vhost-serv-b

네트워크에 컨테이너 연결

$ docker network connect pd24-bridge serv-a
$ docker network connect pd24-bridge serv-b

결과

$ docker network inspect pd24-bridge
[
    {
        "Name": "pd24-bridge",
        "Id": "8f7ab3cdb03d9116c155a488512c814e1cc018ad8c3e6d144d9afa4bab1c600f",
        "Created": "2024-02-14T11:51:59.382107089+09:00",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "172.18.0.0/16",
                    "Gateway": "172.18.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "3f812e315cf94cb36fa6a7844fa5bd7933420a418a75ce07dc44e2a1555d24c3": {
                "Name": "serv-b",
                "EndpointID": "625c4a8c9d708b62e75e26d9fda2c53bde956e05f8a019d00769e9899b32ec0d",
                "MacAddress": "02:42:ac:12:00:03",
                "IPv4Address": "172.18.0.3/16",
                "IPv6Address": ""
            },
            "d1c596915603f6d86b859e0e417f111e97a837c7932aec338e4cfe3df6860d93": {
                "Name": "lb",
                "EndpointID": "19d1780f3f0bb33e0d4a47ee3f28ce22190770636ffa08d215b1ddadb5297097",
                "MacAddress": "02:42:ac:12:00:04",
                "IPv4Address": "172.18.0.4/16",
                "IPv6Address": ""
            },
            "ec04c6c04d375a920dad921e8fcdd26dbbb789c351e04c51f866988d080955da": {
                "Name": "serv-a",
                "EndpointID": "af805a70d09db4dc96698fa7cdee0a29ff183e20bc5dcbfb3f6e4eb81da60630",
                "MacAddress": "02:42:ac:12:00:02",
                "IPv4Address": "172.18.0.2/16",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {}
    }
]