Skip to content

Mahoney-playground/docker-cache-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-cache-action

Example of caching the entire state of docker in /var/lib/docker in order to maintain the cache from a RUN --mount=type=cache command.

The relevant source is in .github.

Note that if /var/lib.docker is big at the end of your build then this is a pretty slow solution, somewhat defeating the objective of a cache! In a real world situation:

  • running the actions/cache@v2 to download the 1.6GB tar ball representing /var/lib/docker takes 38 seconds
  • untarring it takes a further 13 seconds
  • starting docker up again takes 5 seconds

So all told it takes 56 seconds to get docker up and running with the restored /var/lib/docker.

In addition, creating the tar ball at the end of the build takes 15 seconds & uploading it to wherever actions/cache@v2 puts it a further 45 seconds, so that's another minute at the end of your build.

In a real world example this still represents a saving of nearly 2 minutes, so can have value. See:

See stackoverflow: How do I reuse the cache from a RUN --mount=type=cache docker build? for more context.

May be made redundant when/if buildkit #1512 Allow controlling cache mounts storage location is done.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published