Jenkins Pipeline docker.build() gives error '“docker build” requires exactly 1 argument(s)'

前端 未结 1 785
旧巷少年郎
旧巷少年郎 2020-12-30 00:45

With this minimal Jenkins Pipeline script

node {
  docker.build(\"foo\", \"--build-arg x=y\")
}

I\'m getting a confusing error

相关标签:
1条回答
  • 2020-12-30 00:58

    My confusion was because the error message is actually coming from Docker, not Jenkins.

    Docker gives this error if you don't specify a build context (as noted in the docs above).

    The fix is just to add . to the end of the args parameter as per the example, eg:

    node {
      docker.build("foo", "--build-arg x=y .")
    }
    

    See docker: "build" requires 1 argument. See 'docker build --help'

    0 讨论(0)
提交回复
热议问题