O'Reilly logo

Orchestrating Docker by Shrikrishna Holla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Setting up an apt-cacher

When you have multiple Docker servers, or when you are building multiple unrelated Docker images, you might find that you have to download packages every time. This can be prevented by having a caching proxy in-between the servers and clients. It caches packages as you install them. If you attempt to install a package that is already cached, it is served from the proxy server itself, thus reducing the latency in fetching packages and greatly speeding up the build process.

Let's write a Dockerfile that sets up an apt-caching server as a caching proxy server:

FROM ubuntu VOLUME ["/var/cache/apt-cacher-ng"] RUN apt-get update ; apt-get install -yq apt-cacher-ng EXPOSE 3142 RUN echo "chmod 777 /var/cache/apt-cacher-ng ;" + "/etc/init.d/apt-cacher-ng ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required