Is "docker build --network=host" working as expected?

I have been fighting this for a day now. Thanks for the clarification.

I am trying to develop an automated install of many perl CPAN modules that need networking activated to pass tests at installation. Whenever I used the Dockerfile to run cpanm it fails however when I connect into a container and run the commands manually it always worked…

Is it possible to have a build network that is the same as the container?

Otherwise I could build the environment I need in the container manually and then make an image out of that. Not my favourite approach but will work it work?