Contents

使用 Docker 建置 PostgreSQL 資料庫

Contents

docker hub 有範例,但我還是紀錄一下。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# 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

add host

1
2
3
4
5
6
7
8
  adminer:
    image: adminer
    restart: always
    ports:
      - 8080:8080
    extra_hosts:
      - "oracle:162.242.195.82"
      - "finvc:172.31.70.174"

https://github.com/compose-spec/compose-spec/blob/master/spec.md#extra_hosts