在AWS Beanstalk Docker上部署Play Framework时出错

时间:2015-05-31 10:37:22

标签: amazon-web-services playframework docker playframework-2.3

我在AWS Beanstalk上使用Docker运行Play Framework应用程序(运行Docker 1.6.0的64位Amazon Linux 2015.03 v1.4.1)。

Docker文件:

FROM relateiq/oracle-java8
MAINTAINER XXXX
EXPOSE 9000
ADD files /
WORKDIR /opt/docker
RUN ["chown", "-R", "daemon", "."]
RUN ["chmod", "+x", "bin/app"]
USER daemon
ENTRYPOINT ["bin/app"]
CMD []

Dockerrun.aws.json

{
   "AWSEBDockerrunVersion": "1",
   "Ports": [{
       "ContainerPort": "9000"
   }]
}

当实例首次启动时,我会在正常情况下部署大约1分钟,然后在浏览几页后错误显示:

502 Bad Gateway

nginx/1.6.2

ElasticBeanstalk日志中的错误是:

Play server process ID is 1 This application is already running (Or delete /opt/docker/RUNNING_PID file).

我每隔30秒也会收到/var/log/docker-events.log以下消息:

2015-05-30T20:07:58.000000000Z d0425e47095e5e2637263a0fe9b49ed759f130f31c041368ea48ce3d99d1e947: (from aws_beanstalk/current-app:latest) start
2015-05-30T20:08:15.000000000Z d0425e47095e5e2637263a0fe9b49ed759f130f31c041368ea48ce3d99d1e947: (from aws_beanstalk/current-app:latest) die
2015-05-30T20:08:16.000000000Z d0425e47095e5e2637263a0fe9b49ed759f130f31c041368ea48ce3d99d1e947: (from aws_beanstalk/current-app:latest) start
2015-05-30T20:08:31.000000000Z d0425e47095e5e2637263a0fe9b49ed759f130f31c041368ea48ce3d99d1e947: (from aws_beanstalk/current-app:latest) die

有人能看到我的问题吗?欢呼声。

1 个答案:

答案 0 :(得分:0)

build.sbt中添加以下内容可以解决此问题:

javaOptions in Universal ++= Seq("-Dpidfile.path=/dev/null")