Best way to access internet in all containers


I would like to choose the best way to setup internet access in several containers & during the build of these containers. Internet access is available through an enterprise proxy with authentication. I wouldn’t put the configuration directly in the dockerfile or in each container.

What solution I found:
1/ Create a docker with CNTLM, setup an URL to access this service, setup each docker and dockerfile to use this URL
2/ Create a docker with SQUID, setup the docker host to use squid as a transparent proxy.

What is your point of view?
Another way to do this?