PostgreSQL - Start a container with docker compose file

发布时间 2023-12-10 17:22:38作者: ZhangZhihuiAAA

Docker compose file:

services:
  postgres:
    image: postgres:16-alpine
    environment:
      - POSTGRES_USER=root
      - POSTGRES_PASSWORD=aaa
      - POSTGRES_DB=zimple_bank

 

The above environmet variables are necessary. WIthout them, the container can't be initialized successfully. With them, a database named zimple_bank will be automatically created when the container is created.