public:docker:app:postgres

docker 部署 postgresql

docker-compose.yml
version: "3.7"

services:
  db:
    image: postgres:alpine
    restart: always
    volumes:
      - db_data:/var/lib/postgresql/data
      # - ./init.sql:/docker-entrypoint-initdb.d/init.sql
    ports:
      - "5432:5432"
    # env_file:
    #   - .env
    environment:
      # default user name: postgres
      # - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=123456
      # - POSTGRES_DB=postgres
      - TZ=Asia/Shanghai
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 5m
      timeout: 5s
      retries: 3
      # start_period: 1m

  adminer:
    image: adminer
    restart: always
    ports:
      - "8080:8080"

volumes:
  db_data:
  • 最后更改: 2023/08/15 01:11
  • 由 Jinkin Liu