LoginSignup
0
0

More than 5 years have passed since last update.

DockerでPostgreSQLを立ち上げる

Last updated at Posted at 2018-05-26

前提

Dockerはすでにつかえるということが前提となっています

手順

  1. プロセスの立ち上げ$ docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
  2. postgresqlが立ち上がっているかどうかの確認$ docker run -it --rm --link some-postgres:postgres postgres psql -h postgres -U postgres
  3. ファイルを任意の場所に作成し、以下を書き込む
# stack.yml
Example stack.yml for postgres:

# Use postgres/example user/password credentials
version: '3.1'

services:

  db:
    image: postgres
    restart: always
    environment:
      POSTGRES_PASSWORD: example

  adminer:
    image: adminer
    restart: always
    ports:
      - 8080:8080
  1. $ docker-compose -f stack.yml up
  2. localhost:8080でブラウザ確認

ユーザー名とパスワードを入力する画面が出てくる
それぞれ下記のものを入力する

ユーザー名 postgres
パスワード example
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