So you’re interested in creating your own docker image? You keep finding it takes several minutes per run, which is a real pain. No problem, cache everything!
- Wander over to Docker Squid and start using their squid in a docker image.
- Once the docker container is up and running, modify their /etc/squid3/squid.conf to change the cache_dir to allow 10G of storage and cache large objects such as 200M (default is only 512kb). There is an existing line, so search with a regex for “^cache_dir”. Then change the entire line to something like “
cache_dir ufs /var/spool/squid3 10000 16 256 max-size=200000000“, which results in 10G of cache and 200M objects being cachable.
- Change your Dockerfile to use a RUN line with exports for http_proxy, https_proxy, and ftp_proxy, to point to your host’s IP and port 3128. Don’t use ENV, as that will permanently set those for the container once it’s created and running. My line looks like “
RUN export http_proxy=http://192.168.2.5:3128; export https_proxy=http://192.168.2.5:3128; export ftp_proxy=http://192.168.2.5:3128; \“
Doing this took my docker builds from 6-7 minutes down to about 1.5 minutes.