使用 sbt-native-packager 获取对我的 sbt 项目的 docker 支持时出错

Error while using sbt-native-packager to get the docker support for my sbt project

我在我的 plugins.sbt 文件中添加了 sbt-native-packager,版本 1.3.15。 在 build.sbt 文件中,我正在使用 enablePlugins(DockerPligin)。 当我 运行 在 sbt shell 上执行以下命令时,我遇到以下错误:

sbt>docker:publishLocal

错误 -->

    [error] java.io.IOException: Cannot run program "docker" (in directory "C:\Users\A674634\Desktop\Scala\playProjects\akka-cluster-playground\target\docker\stage"): CreateProcess error=2, The system cannot find the file specified
    [error]         at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    [error]         at scala.sys.process.ProcessBuilderImpl$Simple.run(ProcessBuilderImpl.scala:71)
    [error]         at scala.sys.process.ProcessBuilderImpl$AbstractBuilder.run(ProcessBuilderImpl.scala:102)
    [error]         at scala.sys.process.ProcessBuilderImpl$AbstractBuilder.$anonfun$runBuffered(ProcessBuilderImpl.scala:150)
    [error]         at scala.runtime.java8.JFunction0$mcI$sp.apply(JFunction0$mcI$sp.java:12)
    [error]         at com.typesafe.sbt.packager.docker.DockerPlugin$$anon.buffer(DockerPlugin.scala:348)
    [error]         at scala.sys.process.ProcessBuilderImpl$AbstractBuilder.runBuffered(ProcessBuilderImpl.scala:150)
    [error]         at scala.sys.process.ProcessBuilderImpl$AbstractBuilder.$bang(ProcessBuilderImpl.scala:116)
    [error]         at com.typesafe.sbt.packager.docker.DockerPlugin$.publishLocalDocker(DockerPlugin.scala:355)
    [error]         at com.typesafe.sbt.packager.docker.DockerPlugin$.$anonfun$projectSettings(DockerPlugin.scala:127)
    [error]         at com.typesafe.sbt.packager.docker.DockerPlugin$.$anonfun$projectSettings$adapted(DockerPlugin.scala:125)
    [error]         at scala.Function1.$anonfun$compose(Function1.scala:44)
    [error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219(TypeFunctions.scala:40)
    [error]         at sbt.std.Transform$$anon.work(System.scala:67)
    [error]         at sbt.Execute.$anonfun$submit(Execute.scala:269)
    [error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
    [error]         at sbt.Execute.work(Execute.scala:278)
    [error]         at sbt.Execute.$anonfun$submit(Execute.scala:269)
    [error]         at sbt.ConcurrentRestrictions$$anon.$anonfun$submitValid(ConcurrentRestrictions.scala:178)
    [error]         at sbt.CompletionService$$anon.call(CompletionService.scala:37)
    [error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    [error]         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    [error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    [error]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    [error]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    [error]         at java.lang.Thread.run(Thread.java:748)
    [error] Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
    [error]         at java.lang.ProcessImpl.create(Native Method)
    [error]         at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
    [error]         at java.lang.ProcessImpl.start(ProcessImpl.java:137)
    [error]         at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
    [error]         at scala.sys.process.ProcessBuilderImpl$Simple.run(ProcessBuilderImpl.scala:71)
    [error]         at scala.sys.process.ProcessBuilderImpl$AbstractBuilder.run(ProcessBuilderImpl.scala:102)
    [error]         at scala.sys.process.ProcessBuilderImpl$AbstractBuilder.$anonfun$runBuffered(ProcessBuilderImpl.scala:150)
    [error]         at scala.runtime.java8.JFunction0$mcI$sp.apply(JFunction0$mcI$sp.java:12)
    [error]         at com.typesafe.sbt.packager.docker.DockerPlugin$$anon.buffer(DockerPlugin.scala:348)
    [error]         at scala.sys.process.ProcessBuilderImpl$AbstractBuilder.runBuffered(ProcessBuilderImpl.scala:150)
    [error]         at scala.sys.process.ProcessBuilderImpl$AbstractBuilder.$bang(ProcessBuilderImpl.scala:116)
    [error]         at com.typesafe.sbt.packager.docker.DockerPlugin$.publishLocalDocker(DockerPlugin.scala:355)
    [error]         at com.typesafe.sbt.packager.docker.DockerPlugin$.$anonfun$projectSettings(DockerPlugin.scala:127)
    [error]         at com.typesafe.sbt.packager.docker.DockerPlugin$.$anonfun$projectSettings$adapted(DockerPlugin.scala:125)
    [error]         at scala.Function1.$anonfun$compose(Function1.scala:44)
    [error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219(TypeFunctions.scala:40)
    [error]         at sbt.std.Transform$$anon.work(System.scala:67)
    [error]         at sbt.Execute.$anonfun$submit(Execute.scala:269)
    [error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
    [error]         at sbt.Execute.work(Execute.scala:278)
    [error]         at sbt.Execute.$anonfun$submit(Execute.scala:269)
    [error]         at sbt.ConcurrentRestrictions$$anon.$anonfun$submitValid(ConcurrentRestrictions.scala:178)
    [error]         at sbt.CompletionService$$anon.call(CompletionService.scala:37)
    [error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    [error]         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    [error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    [error]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    [error]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    [error]         at java.lang.Thread.run(Thread.java:748)
    [IJ]sbt:akka-cluster-playground> [error] (Docker / publishLocal) java.io.IOException: Cannot run program "docker" (in directory "C:\Users\A674634\Desktop\Scala\playProjects\akka-cluster-playground\target\docker\stage"): CreateProcess error=2, The system cannot find the file specified

我认为您应该在项目根文件夹中执行该命令。你现在在哪个文件夹?