sbt-native-packager icon indicating copy to clipboard operation
sbt-native-packager copied to clipboard

Error when building and publishing docker image with multiple tags

Open viktor-thell-seal opened this issue 3 years ago • 3 comments

Expected behaviour

Expecting the following command to build a docker image, tag it with two tags; the version and 'another-tag':

sbt "set dockerAliases in Docker ++= Seq(dockerAlias.value.withTag(Option(\\\"another-tag\\\")))" docker:publish

Actual behaviour

When running the command I get the following output:

[2020-09-28T13:50:01.274Z] [info] Defining Docker / dockerAliases
[2020-09-28T13:50:01.274Z] [info] The new value will be used by Docker / clean, Docker / publish, Docker / publishLocal
[2020-09-28T13:50:01.274Z] [info] Reapplying settings...
[2020-09-28T13:50:01.274Z] [info] Set current project to my-project (in build file:/home/dev/workspace/my-project/)
[2020-09-28T13:50:01.536Z] [success] All package validations passed
[2020-09-28T13:50:03.446Z] [info] Sending build context to Docker daemon  120.2MB
...
[2020-09-28T13:50:30.767Z] [info] Removing intermediate container 2983c6aaf32e
[2020-09-28T13:50:30.767Z] [info] Successfully built 752e72805dcb
[2020-09-28T13:50:30.767Z] [info] Successfully tagged docker.registry.net/my-project:1.2.3
[2020-09-28T13:50:30.767Z] [info] Not removing multi-stage intermediate image(s) because id is missing in Dockerfile (Comment: "# id=...")
[2020-09-28T13:50:30.767Z] [info] Built image docker.registry.net/my-project with tags [1.2.3, another-tag]
[2020-09-28T13:50:31.031Z] [info] The push refers to a repository [docker.registry.net/my-project]
[2020-09-28T13:50:31.031Z] [info] 4b44a6eb6830: Preparing
...
[2020-09-28T13:50:43.279Z] [info] 4b44a6eb6830: Pushed
[2020-09-28T13:50:43.279Z] [info] 1.2.3: digest: sha256:4da1f7439e5d81fa1399935c9c824fe38760549032b19ca7a2d7f5d4bd65db49 size: 2415
[2020-09-28T13:50:43.279Z] [info] Published image docker.registry.net/my-project:1.2.3
[2020-09-28T13:50:43.279Z] [info] The push refers to a repository [docker.registry.net/my-project]
[2020-09-28T13:50:43.279Z] [error] tag does not exist: docker.registry.net/my-project:another-tag
[2020-09-28T13:50:43.279Z] [error] java.lang.RuntimeException: Nonzero exit value: 1
[2020-09-28T13:50:43.279Z] [error] 	at scala.sys.package$.error(package.scala:26)
[2020-09-28T13:50:43.279Z] [error] 	at com.typesafe.sbt.packager.docker.DockerPlugin$.publishDocker(DockerPlugin.scala:688)
[2020-09-28T13:50:43.279Z] [error] 	at com.typesafe.sbt.packager.docker.DockerPlugin$.$anonfun$projectSettings$53(DockerPlugin.scala:261)
[2020-09-28T13:50:43.279Z] [error] 	at com.typesafe.sbt.packager.docker.DockerPlugin$.$anonfun$projectSettings$53$adapted(DockerPlugin.scala:260)
[2020-09-28T13:50:43.279Z] [error] 	at scala.collection.immutable.List.foreach(List.scala:388)
[2020-09-28T13:50:43.279Z] [error] 	at com.typesafe.sbt.packager.docker.DockerPlugin$.$anonfun$projectSettings$52(DockerPlugin.scala:260)
[2020-09-28T13:50:43.279Z] [error] 	at com.typesafe.sbt.packager.docker.DockerPlugin$.$anonfun$projectSettings$52$adapted(DockerPlugin.scala:255)
[2020-09-28T13:50:43.279Z] [error] 	at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[2020-09-28T13:50:43.279Z] [error] 	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:40)
[2020-09-28T13:50:43.279Z] [error] 	at sbt.std.Transform$$anon$4.work(System.scala:67)
[2020-09-28T13:50:43.279Z] [error] 	at sbt.Execute.$anonfun$submit$2(Execute.scala:269)
[2020-09-28T13:50:43.279Z] [error] 	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[2020-09-28T13:50:43.279Z] [error] 	at sbt.Execute.work(Execute.scala:278)
[2020-09-28T13:50:43.279Z] [error] 	at sbt.Execute.$anonfun$submit$1(Execute.scala:269)
[2020-09-28T13:50:43.279Z] [error] 	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[2020-09-28T13:50:43.279Z] [error] 	at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[2020-09-28T13:50:43.279Z] [error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[2020-09-28T13:50:43.279Z] [error] 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[2020-09-28T13:50:43.279Z] [error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[2020-09-28T13:50:43.279Z] [error] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[2020-09-28T13:50:43.279Z] [error] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[2020-09-28T13:50:43.279Z] [error] 	at java.lang.Thread.run(Thread.java:748)
[2020-09-28T13:50:43.279Z] [error] (Docker / publish) Nonzero exit value: 1
[2020-09-28T13:50:43.279Z] [error] Total time: 42 s, completed Sep 28, 2020 1:50:43 PM

Information

  • What sbt-native-packager are you using 1.7.5
  • What sbt version 1.2.8
  • What is your build system (e.g. Ubuntu, MacOS, Windows, Debian ) Ubuntu 16.04.3 LTS
  • What package are you building (e.g. docker, rpm, ...) docker
  • What version has your build tool (find out with e.g. rpm --version) docker 17.05.0-ce

viktor-thell-seal avatar Sep 28 '20 14:09 viktor-thell-seal

Thanks @viktor-thell-seal for your detailed issue :smiley:

Do you have a clue what

[2020-09-28T13:50:43.279Z] [info] The push refers to a repository [docker.registry.net/my-project]
[2020-09-28T13:50:43.279Z] [error] tag does not exist: docker.registry.net/my-project:another-tag

this means? Was the tag not built locally and docker tries to push it?

muuki88 avatar Sep 29 '20 07:09 muuki88

Running into same issue.

Information What sbt-native-packager are you using 1.9.9 What sbt version 1.7.1 What package are you building (e.g. docker, rpm, ...) docker

oschrenk avatar Jul 15 '22 15:07 oschrenk

Maybe it would help to see what shell commands it's trying to run

nafg avatar Aug 29 '22 22:08 nafg