From f4ec67dbc4ff3074d2f2d1488f540804257b67ce Mon Sep 17 00:00:00 2001 From: Kohei Watanabe Date: Fri, 17 Jun 2022 16:47:50 +0900 Subject: [PATCH] create docker-network example --- docker-network/README.md | 15 +++++++++++++++ docker-network/compose.yml | 18 ++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 docker-network/README.md create mode 100644 docker-network/compose.yml diff --git a/docker-network/README.md b/docker-network/README.md new file mode 100644 index 0000000..4580caf --- /dev/null +++ b/docker-network/README.md @@ -0,0 +1,15 @@ +やりたいこと: 複数の NIC がある環境でそれぞれ Docker コンテナに割り当てたい + +メモ: + +```sh +docker compose create +sudo apt install -y bridge-utils +sudo brctl addif br-nic-a +docker compose start +# brctl show +``` + +インターネットにつながることは確認できなかった。 +NIC を割り当てることはできた。 +あとは IP アドレスを振れば問題無いか。 diff --git a/docker-network/compose.yml b/docker-network/compose.yml new file mode 100644 index 0000000..6192021 --- /dev/null +++ b/docker-network/compose.yml @@ -0,0 +1,18 @@ +services: + a: + image: alpine + network_mode: none + networks: + a: + ipv4_address: "10.10.1.10" + command: ping 8.8.8.8 +networks: + a: + driver: bridge + internal: true + driver_opts: + com.docker.network.bridge.name: br-nic-a + ipam: + config: + - subnet: "10.10.1.0/24" + gateway: "10.10.1.1"