欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

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

程序员文章站 2024-03-16 17:54:10
...
  • 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