【发布时间】:2020-04-02 11:50:51
【问题描述】:
我正在对我的 scala play 框架应用程序进行 dockerizing。 Docker 构建成功,但 docker run 以代码 0 退出。
user-service | [info] Loading project definition from /app/project
user-service | [info] Set current project to user-service (in build file:/app/)
user-service |
user-service | SLF4J: Class path contains multiple SLF4J bindings.
user-service | SLF4J: Found binding in [jar:file:/app/lib/logback-classic-1.2.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
user-service | SLF4J: Found binding in [jar:file:/root/.ivy2/cache/ch.qos.logback/logback-classic/jars/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
user-service | SLF4J: Found binding in [jar:file:/root/.ivy2/cache/org.slf4j/slf4j-nop/jars/slf4j-nop-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
user-service | SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
user-service | SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
user-service | --- (Running the application, auto-reloading is enabled) ---
user-service |
user-service | [info] p.c.s.AkkaHttpServer - Listening for HTTP on /0.0.0.0:9004
user-service |
user-service | (Server started, use Enter to stop and go back to the console...)
user-service |
user-service | [info] p.c.s.AkkaHttpServer - Stopping server...
user-service |
user-service | [success] Total time: 4 s, completed Apr 2, 2020 10:40:20 AM
user-service exited with code 0
我的 Dockerfile
FROM sshek2019/docker-scala
WORKDIR '/app'
COPY
EXPOSE 9004
CMD ["sbt", "run"]
我的 docker-compose 文件
version: "3.7"
services:
api:
build: .
container_name: user-service
expose:
- "9004"
ports:
- "9004:9004"
【问题讨论】:
-
你能在调试模式下运行docker吗,
-
如何在调试模式下运行docker?
-
还有一点我想说的是,它在交互式终端模式下运行良好。
-
Play 的设置includes the sbt-native-packager plugin,其中包括support to build a Docker image。您可以尝试在
build.sbt文件中配置它,然后使用sbt docker:publishLocal获取图像。
标签: java scala docker playframework docker-compose