我使用自定义docker容器来构建代码,该容器与Amazon codebuild集成。AWS codebuild启动一个Docker容器,并在我们提供的容器上构建代码。我写的容器的Dockerfile文件是这样的-> Dockerfile
Docker容器应该安装了Java-8、Gradle-4.7和Postgres-10。
我在本地机器上运行Docker容器,可以看到Postgres服务正在运行。但是,在AWS codebuild上,docker容器不会启动Postgres服务器。我尝试使用buildspec.yml文件中的命令了解Postgres的状态,发现它已关闭。
以下是我在cloudwatch日志中看到的错误-
May 18, 2018 9:26:33 AM org.postgresql.Driver connect
SEVERE: Connection error:
org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.有人知道这是怎么回事吗?Dockerfile是否正确?
发布于 2018-05-22 00:51:25
问题实际上可能是入口点(在您提到的Dockerfile中)。
CodeBuild将在每次运行时覆盖入口点,这与您在本地docker运行中看到的不同(您也可以使用codebuild本地代理测试此行为)
"ENTRYPOINT ["/etc/init.d/postgresql", "start"]"你能发布你的buildspec.yml文件吗?解决这个问题的简单方法是将入口点命令作为buildspec.yml的一部分运行
https://stackoverflow.com/questions/50449416
复制相似问题