When the FROM image is taken from a private repository we get this error message:
ERROR: Received unexpected HTTP status: 502 Connection refused
The reason seems to be the fact that you don't add the X-Registry-Config header. Instead you add X-Registry-Auth.
See the details for the request here:
https://docs.docker.com/engine/reference/api/docker_remote_api_v1.23/#build-image-from-a-dockerfile
Thanks for the fix