LoginSignup
0
0

More than 3 years have passed since last update.

Docker Rails6.0 Mysql8.0.20 でdbコンテナの名前指定

Posted at

メモです

問題だったところ

Dockerを触って3日目。dbコンテナの名前を「db」にしたかったのにやり方がわからなかったので調べたらそのままだった。


version: '3'
services:
  db:
    image: mysql:8.0.20
    container_name: db # ここで名前の指定をする
    ports:
      - "3306:3306"
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_PASSWORD: pass
      TZ: 'Asia/Tokyo'
    volumes:
      - ./mysql-confd:/etc/mysql/conf.dcollation-server=utf8mb4_ja_0900_as_cs
      - ./tmp/db:/var/lib/postgresql/data
      - ./mysql-confd:/etc/mysql/conf.d
  web:
    build: 
        context: ./
        dockerfile: docker/Dockerfile
    container_name: rails_web
    volumes:
      - .:/usr/src
    ports:
      - "3000:3000"
    environment:
      PORT: 3000
      BINDING: 0.0.0.0
    stdin_open: true
    tty: true
    links:
      - db
    depends_on:
      - db

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