【发布时间】:2015-11-26 03:02:35
【问题描述】:
我正在尝试使用以下命令将 scala 构建发布到 docker 注册表:
./sbt "; set dockerRepository := Some(\"registryname/project\"); docker:publish"
我正在指定 dockerRepository,但是在运行命令时会抛出以下错误:
[error] You cannot push a "root" repository. Please rename your repository to <user>/<repo> (ex: <user>/example)
java.lang.RuntimeException: Repository for publishing is not specified.
[error] (all/*:publishConfiguration) Repository for publishing is not specified.
[error] (server/docker:publish) Nonzero exit value: 1
[error] (config/*:publishConfiguration) Repository for publishing is not specified.
[error] Total time: 63 s, completed 01/09/2015 10:48:04 AM
当我查看本地 docker 注册表时,我可以看到它编译了 docker 映像,但没有为 docker 注册表名称添加前缀:
docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
example 0.0.1 SNAPSHOT a6eb8942aa9f 8 minutes ago 1.136 GB
所以它似乎不接受我在命令上设置的 dockerRepository 变量,这也在构建日志中:
[15:32:58][Step 4/5] [info] Loading project definition from /build/project
[15:33:01][Step 4/5] [info] Set current project to example (in build file:/build/)
[15:33:06][Step 4/5] [info] Defining {.}/*:dockerRepository
[15:33:06][Step 4/5] [info] The new value will be used by no settings or tasks.
[15:33:06][Step 4/5] [info] Reapplying settings...
【问题讨论】:
-
你搞清楚了吗?
-
它归结为变量范围 try : ./sbt "; set dockerRepository in ThisBuild := Some(\"registryname/project\"); docker:publish"