docker build没有创建镜像

时间:2019-05-02 12:40:26

标签: docker sbt

我有一个sbt项目,我已经在其根目录中编写了一个dockerFile,这里是Dockerfile

FROM hseeberger/scala-sbt:11.0.2_2.12.8_1.2.8

MAINTAINER name <email@gmail.com>


RUN echo "==> run the project..."       && \
    echo "==> it will take some time!!!"  && \
    sbt run


WORKDIR /hazelcastscalaserver


# Define default command.
CMD ["sbt", "run"]

当我做docker build -t test/project .时 而不是dcoker创建映像,它开始运行此处的命令,这应该是预期的行为,因为它应该构建映像,然后我将通过docker run test/project:latest运行该映像,并且我的项目开始运行,但是在我误解的地方没有发生?

这是docker build

的结果
Sending build context to Docker daemon  208.1MB
Step 1/5 : FROM hseeberger/scala-sbt:11.0.2_2.12.8_1.2.8
 ---> 349a7e4f4029
Step 2/5 : MAINTAINER name <name@gmail.com>
 ---> Using cache
 ---> e92083819853
Step 3/5 : RUN echo "==> run the project..."       &&     echo "==> it will take some time!!!"  &&     sbt run
 ---> Running in 226ce249a353
==> run the project...
==> it will take some time!!!
[info] Updated file /root/project/build.properties: set sbt.version to 1.2.8
[info] Loading project definition from /root/project
[info] Updating ProjectRef(uri("file:/root/project/"), "root-build")...
[info] Done updating.
[info] Set current project to root (in build file:/root/)
[info] Updating ...
[info] Done updating.
[info] Packaging /root/target/scala-2.12/root_2.12-0.1.0-SNAPSHOT.jar ...
[info] Done packaging.
[error] java.lang.RuntimeException: No main class detected.
[error]     at scala.sys.package$.error(package.scala:26)
[error] (Compile / bgRun) No main class detected.
[error] Total time: 0 s, completed May 2, 2019, 12:37:43 PM
The command '/bin/sh -c echo "==> run the project..."       &&     echo "==> it will take some time!!!"  &&     sbt run' returned a non-zero code: 1

0 个答案:

没有答案