5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Dockerで、すぐにDBを試せるdocker-compose.ymlを作ったよ

Posted at

急にDBにアクセスして、SQLとか打ちたくなる時があるよね
(そんなことはないよね)

すぐにいろんなDBのコンテナを起動して、
試せるdocker-compose.ymlを作成したから、
よかったら、使ってみてね。

docker-compose.yml

docker-compose.yml
version: '3'
services:
  mongo:
    image: mongo:4.1.13
    volumes:
      - ./mongo:/data/db
    ports:
      - "50011:27017"
    environment:
      MONGO_INITDB_DATABASE: sample_mongo
      MONGO_INITDB_ROOT_USERNAME: mongo
      MONGO_INITDB_ROOT_PASSWORD: mongo
  postgres:
    image: postgres:12
    volumes:
      - ./postgres:/var/lib/postgresql/data
    ports:
      - "50012:5432"
    environment:
      POSTGRES_DB: sample_postgres
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
  mysql:
    image: mysql:8.0.17
    volumes:
      - ./mysql:/var/lib/mysql
    ports:
      - "50013:3306"
    command: --default-authentication-plugin=mysql_native_password
    environment:
      MYSQL_DATABASE: sample_mysql
      MYSQL_ROOT_PASSWORD: mariadb
  mariadb:
    image: mariadb:10.4.7
    volumes:
      - ./mariadb:/var/lib/mysql
    ports:
      - "50014:3306"
    environment:
      MYSQL_DATABASE: sample_mariadb
      MYSQL_ROOT_PASSWORD: mariadb

GitHub

終わり

mongoは触ったことないから触ってみようかな

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?