LoginSignup
3
8

More than 5 years have passed since last update.

Dockerネットワーク設定

Last updated at Posted at 2018-06-18

現在のネットワークを確認

ネットワーク一覧を確認します。

$ docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
23847b6h3971        bridge              bridge              local
34368dnf9b16        host                host                local
02em5e1bec4f        none                null                local

bridgeのネットワークを確認。

$ docker network inspect bridge

Dockerネットワークを作成

ブリッジネットワーク br0を作成してみます。

$ docker network create --subnet=192.198.160.0/24 br0

追加したネットワーク内にコンテナを作成

作成したbr0内のIPを指定してコンテナを作成&起動します。

$ docker run -it --name containername -h hostname --net=br0 --ip=192.198.160.10 ubuntu bash

IP確認

$ docker inspect -f "{{.NetworkSettings.IPAddress}}" コンテナID
3
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
8