How to publish a docker image to a private docker registry using Jenkins' blueocean?
You can try to use scripting syntax into the declarative pipeline. For some step there is no declarative syntax yet. I had the same problem trying to use the docker global variable as a step.

stage ('Docker Build') {
  steps {
    // prepare docker build context
    sh "cp target/project.war ./tmp-docker-build-context"

    // Build and push image with Jenkins' docker-plugin
    script {
      withDockerServer([uri: "tcp://&lt;my-docker-socket&gt;"]) {
        withDockerRegistry([credentialsId: 'docker-registry-credentials', url: "https://&lt;my-docker-registry&gt;/"]) {
            // we give the image the same version as the .war package
            def image = docker.build("&lt;myDockerRegistry&gt;/&lt;myDockerProjectRepo&gt;:${branchVersion}", "--build-arg PACKAGE_VERSION=${branchVersion} ./tmp-docker-build-context")
            image.push()
        }
      }
    }
  }
}