Building docker-ce 19.03 inside dind container

Hi! I’ve been trying to build docker-ce codebase (engine and cli) after applying some patches to the overlay2 storage driver code inside a gitlab dind container. Everything seems to go as planned till right after the docker-dev image is built. When the docker-dev container is lauched to build the binary, this error is seen:

#69 naming to Docker
#69 naming to Docker done
#69 DONE 0.1s
docker: invalid publish opts format (should be name=value but got ‘tcp://172.17.0.5:2375’).
See ‘docker run --help’.
make[2]: *** [binary] Error 125

I have the following DOCKER_ envvars set for pointing docker-cli to the dockerd running inside the docker:dind service container hosted by gitlab.

DOCKER_HOST=tcp://docker:2375

Aside from this there are some proxy variables for docker-dind to pull dependencies down from the internet. Am using docker:18.09.0-dind image pulled from Docker Hub since that seems to be working with my setup.

I was not able to find a clear explanation for this error anywhere. Would really appreciate it if somebody could clarify and help suggest a situation.