1

使用sbt-docker插件,我执行sbt dockerBuildAndPush并在组装后看到以下输出:

...
[info] Pushing docker image with name: 'myorg/myrepo'
[info] The push refers to a repository [myorg/myrepo] (len: 1)
[info] Sending image list
[info] Pushing repository myorg/myrepo (1 tags)
[info] 511136ea3c5a: Pushing
[info] 511136ea3c5a: Image already pushed, skipping
[info] 19df420c532f: Pushing
[info] 19df420c532f: Image already pushed, skipping
... 14 more of these message pairs ...
[info] 53531ebeee8d: Pushing
[info] 53531ebeee8d: Buffering to disk
[info] time="2015-04-08T20:50:50+10:00" level="fatal" msg=""
java.lang.RuntimeException: Nonzero exit code: 1
at scala.sys.process.BasicIO$Streamed$.scala$sys$process$BasicIO$Streamed$$next$1(BasicIO.scala:48)
...

build.sbt包括:

docker <<= (docker dependsOn assembly)

dockerfile in docker := {
  val artifact = (assemblyOutputPath in assembly).value
  val artifactTargetPath = "/app/server.jar"
  new Dockerfile {
    from("java:8")
    maintainer("MyOrg", "dev@myorg.com")
    workDir("/app")
    run("mkdir", "-p", "/app/data")
    run("chown", "daemon", "/app/data")
    user("daemon")
    add(artifact, artifactTargetPath)
    entryPoint("java", "-Xmx8g", "-jar", artifactTargetPath)
    expose(8080)
  }
}

imageNames in docker := Seq(
  ImageName("myorg/myrepo")
)

为什么会失败?

4

0 回答 0