LoginSignup
7
7

More than 5 years have passed since last update.

docker-compose up するときに subnet を指定する

Posted at

概要

アドレスを変えたかったので、やりかたを調べた

まとめ

docker-compose.yml に、書く。

192.168.210.0/24 を使いたいときは、以下のような感じ。
具体的には、networks のところを追加した。

version: "2"
services:
  mongo:
    image: mongo
    volumes:
      - /home/vagrant/work/github/togelack/datadir:/data/db
    restart: always
  app:
    build: .
    ports:
      - 3000:3000
    environment:
      SECRET_KEY_BASE: xxxxx
      RAILS_ENV: production
      MONGOID_ENV: production
      SLACK_TOKEN: xoxp-xxxxx
      SLACK_CLIENT_ID: 'xxxx.xxxxx'
      SLACK_CLIENT_SECRET: xxxxxxx
      SLACK_TEAM_ID: xxxxxx
      SLACK_TEAM_NAME: xxxxxx
      MONGO_URL: mongodb://mongo:27017/togelack
    restart: always
networks:
  default:
    ipam:
      config:
        - subnet: 192.168.210.0/24

7
7
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
7
7