We are encouraging our developers to use the new declarative pipeline syntax with docker agents to fully isolate their builds and give them control over the environment. However, when said builds in turn produce docker images (such as via the docker-maven-plugin) they do not work with this approach, giving an error along the lines of
There are a few ways to resolve this, from setting the DOCKER_HOST variable and exposing and outside docker daemon to the container, or mounting the hosts's /var/run/docker.sock into the image. However it is not clear that there is a way to achieve this without requiring developers to include these steps in their Jenkinsfiles. It would be great if for example there was a way to se thte default options that get applied to a docker invocation in a pipeline so that developers do not have to worry about these concerns and this style of build could be supported system-wide.