I set up an example repository to demonstrate the problem: https://github.com/derphilipp/jenkins_docker_host_bug
We assume we have a node/slave/agent to run docker on (label "docker")
and a non-docker node/slave/agent (here: raspberrypi).
Although the second step in the file has a different agent set, Jenkins still tries to call the docker command to set up something which results in file-not-found exception in Java (see README.md of the example project)
In this example it could be fixed by specifying the node/agent/slave not for the whole pipeline but for the first step, but I want the use the default for every step in a longer Jenkinsfile.