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

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


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'