(20210316已解决)docker-compose创建postgresql容器exited with code 1

  • Overview

    通过docker-compose创建postgresql容器总是失败,log显示为containerName exited with code 1

    Exit Code 1: Indicates failure due to application error

  • Solution

    docker-compose.yaml文件中添加environment变量:

    environment:
        POSTGRES_USER: example
        POSTGRES_PASSWORD: example1234
        POSTGRES_DB: example
    

    我猜想是,初始化时要指定用户名、密码、数据库

  • References

  1. Understanding Docker Container Exit Codes
  2. Docker-compose up exited with code 1 but successful docker-compose build

猜你喜欢

转载自blog.csdn.net/The_Time_Runner/article/details/115261284