Jenkinsfile: Pull image from registry endpoint A, push built image to registry endpoint B
Try to chain withRegistry like this:

docker.withRegistry('https://registry:10500', 'credentials-id') {
    docker.withRegistry('https://registry:10501', 'credentials-id') {
        docker.build(imageToBuild.getName(), '-f ' + imageToBuild.tag + '.Dockerfile .').push();
    }
}