This is a newbie level tutorial about creating a faster Docker development environment, mainly via caching. It covers setting up a an APT cache and caching of intermediate images during builds.
Use an APT Cache
This is right in the Docker site: Dockerize an apt-cacher-ng service
Apt-cacher-ng is a server that caches copies of Debian packages, so the first download is slow, but subsequent downloads are lightning fast.
The tutorial works, but it’s a little off on integrating it into a build, so I’m working on a complementary tutorial to explain that. Subscribe to the site to get alerted when it’s done.
Force Docker to Re-RUN a Step and Ignore the Cached Value
Docker caches the results of a RUN line by creating a new image. If it sees the RUN line again, it uses the cached copy instead of running it again.
See Remove Docker Cached Intermediate Images to learn a few techniques to get around this problem