我试图通过docker-compose 1.1.0 / boot2docker 1.5.0在OS X上运行Dockerized Play app.然而,它并没有真正地发挥(原谅双关语)……
问题是应用程序必须使用伪TTY(由Docker提供)运行,这使得boot2docker在尝试连接时挂起.
我运行应用程序,通过docker-compose up,它挂起如下所示:
> docker-compose up
Recreating exampleapp_web_1...
Attaching to exampleapp_web_1
但是,如果我直接运行应用程序,没有docker-compose,它可以工作:
> docker rm exampleapp_web_1 ; docker run -p 9000:9000 -ti --name exampleapp_web_1 -v `pwd`:/code -v `pwd`/.docker_home:/root exampleapp_web
[info] Loading project definition from /code/project
[info] Set current project to example-app (in build file:/code/)
--- (Running the application,auto-reloading is enabled) ---
[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
(Server started,use Ctrl+D to stop and go back to the console...)
如何在我的场景中进行docker-compose工作?
泊坞窗,compose.yml
web:
build: .
command: run
ports:
- "9000:9000"
volumes:
- .:/code
- .docker_home:/root
stdin_open: true
tty: true
Dockerfile
FROM aknudsen/play-with-node
MAINTAINER Arve Knudsen @L_404_3@似乎在描述这个问题.
最佳答案
看到这个网址https://www.playframework.com/documentation/2.4.x/ProductionConfiguration
在生产中运行应用程序的步骤
1)在项目文件夹中,运行$sbt dist@H_403_45@2)从项目根目录执行此命令./target/universal/your-app-name -javaArguments …
在docker-compose中
web:
build: .
command: sbt dist && ./target/universal/app-name -JavaArguments
ports:
- "9000:9000"
volumes:
- .:/code
- .docker_home:/root
stdin_open: true
tty: true