Magic caching proxy and wrapper to speed up those Docker build times.
1.6K
Ever get tired of waiting for your docker images to apt-get update?
Yeah, me too. So does Jenkins.
Use this with something similar to the provided wrapper around docker and docker-compose, which automatically add --build-args for http_proxy and https_proxy. For docker-compose, you'll need to add in a blank passthrough build_arg for the proxy URLs, as shown in docker-compose.build.yml.
Just use the docker-compose.yml:
# Start proxy instance
docker-compose up -d
This compose file sets restart=always, making sure it's always available when you need it.
Due to this, the provided docker-compose.yml file requires docker-compose>=1.6.0 due to it's requirement on version 2 syntax.
You'll then need to wrap docker and docker-compose by putting the provided script in your local user PATH, somewhere before the wrapped commands.
If you don't have one of these setup:
mkdir -p "$HOME/bin"
echo 'PATH="$HOME/bin:$PATH"' >> ~/.bashrc
Viola.
Every once in a while you run into a crappy image that doesn't support the http_proxy build argument.
In that case, just set the NOPROXY variable for that run:
## Standard
$ docker build -t blah .
<ERROR>
$ NOPROXY=1 !!
# ^ Replaced with last command in most shells.
Content type
Image
Digest
Size
69.3 MB
Last updated
over 8 years ago
docker pull trevorj/docker-build-proxy