Help us understand the problem. What is going on with this article?

docker-composeでブリッジネットワークのIPを変える

More than 1 year has passed since last update.

過去に何度もdocker0のIPアドレス帯を変えてきたが、docker-composeを使うと、docker0が設定されていても個別にブリッジネットワークを作成するようだ。そこでまた172.17....のネットワークが出現してしまう現象が発生した。

例によって私の環境は172.17.X.Xの帯域を使っているので接続不能に。ということで、また調査を行いました。

設定方法

いろいろ試したが、下記のようにdefaultネットワークのsubnetを設定すれば良い。

version: '2'

services:
....
networks:
  default:
    driver: bridge
    ipam:
      driver: default
      config:
        - subnet: 192.168.201.0/24

注意としてdocker0のネットワークとは別のsubnetを指定する必要がある。

参考

docker-compose up するときに subnet を指定する
https://qiita.com/manabuishiirb/items/293d5d5a3ec7d5328cc5

Docker container networking – Docker Documentation
http://docs.docker.jp/compose/compose-file.html#network-configuration-reference

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away