{"id":20487301,"url":"https://github.com/suryagaddipati/docker-cache-volume-plugin","last_synced_at":"2025-04-13T15:34:50.903Z","repository":{"id":66308610,"uuid":"109861030","full_name":"suryagaddipati/docker-cache-volume-plugin","owner":"suryagaddipati","description":"Docker volume driver to cache container artifacts","archived":false,"fork":false,"pushed_at":"2017-11-16T18:06:42.000Z","size":10388,"stargazers_count":8,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-27T06:23:06.430Z","etag":null,"topics":["docker","driver","volume"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/suryagaddipati.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-07T16:23:50.000Z","updated_at":"2023-07-01T00:44:50.000Z","dependencies_parsed_at":"2023-03-30T23:33:47.579Z","dependency_job_id":null,"html_url":"https://github.com/suryagaddipati/docker-cache-volume-plugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suryagaddipati%2Fdocker-cache-volume-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suryagaddipati%2Fdocker-cache-volume-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suryagaddipati%2Fdocker-cache-volume-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suryagaddipati%2Fdocker-cache-volume-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suryagaddipati","download_url":"https://codeload.github.com/suryagaddipati/docker-cache-volume-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248736553,"owners_count":21153609,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","driver","volume"],"created_at":"2024-11-15T16:40:51.063Z","updated_at":"2025-04-13T15:34:50.894Z","avatar_url":"https://github.com/suryagaddipati.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"Docker volume driver to give your container exclusive view of underlying filesystem cache using [overlayfs](https://www.kernel.org/doc/Documentation/filesystems/overlayfs.txt).Think of it as `Read committed Isolation level` for your filesystem cache between concurrently running containers.\nChanges made by container are synced back to cache on container exit.\n\n*Note*: There is no conflict resolution between changes made by concurrent containers, latest container to exit overwrites all previous changes.\n\n### Installation\n\n`docker plugin install rapt/cachedriver`\n\n### Usage\n\nVolume name is expected to be in `\u003ccache-name\u003e-\u003cunique-id\u003e`\n\neg:\n\n```\ndocker run --rm -it  --name one --volume-driver rapt/cachedriver  -v foo-one:/data busybox sh\n/ # ls /data/\n/ #  echo one \u003e\u003e /data/foo-one.txt\n```\n\nAn underlying cache `foo` is created at this point but contents written to this cache by the running container is not visible to concurrently running containers.\neg:\n```\ndocker run --rm -it --name two --volume-driver rapt/cachedriver   -v foo-two:/data busybox sh\n/ #  ls /data/        #foo-one.txt is not visible There\n\n```\nconcurrently running containers `one` and `two` get an isolated view of the cache.\n\nOnce container `one`  exits changes made by it are written back to the cache.\n\n```\ndocker run --rm -it --name three --volume-driver  rapt/cachedriver  -v foo-three:/data busybox sh\n/ #  ls /data/\n/ #  foo-one.txt\n```\nchanges made by container `one` are visible to container `three` after container `one` exits.\n\n### Use cases\n* ###### Build caches in a continuous integration system.\n  Build Systems like maven, sbt cache their artifacts but multiple processes cannot use a sigle underlying maven cache due to concurrency issues and exclusive locks.  Each maven process requires an isolated view of underlying cache.\n\n  ```\n  docker run --rm -it --name one --volume-driver rapt/cachedriver  -v foo-one:/~/.m2 busybox sh\n  / #  mvn install  \n  ```\n\n  ```\n  docker run --rm -it --name two --volume-driver  rapt/cachedriver  -v foo-two:/~/.m2 busybox sh\n  / #  mvn install   # .m2 cache is primed here by one\n  ```\n### How does it work?\n\nDriver uses overlayfs to provide exclusive view of  `lower` directory.\n\n```\n docker run --rm -it --name three --volume-driver  rapt/cachedriver  -v foo-three:/data busybox sh\n\n / # echo foo-one \u003e /data/foo-one.txt\n / # exit\n\n ```\n\n Inside volume driver container\n\n ```\n  / #  docker-runc exec -t 58211af9d85c0e6e095a822f93b6522f0a3fed776c8d9bd72f62a41ebfa7e5c2 sh\n\n  / #  mount | grep foo\noverlay on /mnt/cache/merged/foo/three type overlay (rw,relatime,lowerdir=/mnt/cache/lower/foo/0,upperdir=/mnt/cache/upper/foo/three,workdir=/mnt/cache/work/foo/three)\n\n  / #  ls /mnt/cache/lower/foo/\n   0    cache-state.json\n\n  / #  cat /mnt/cache/lower/foo/cache-state.json\n   {\"state\":{\"latest\":\"0\"}}\n ```\n\nAfter container `one` exits\n\n```\n/ # ls /mnt/cache/lower/foo/\n  0     cache-state.json  three\n\n/ # cat /mnt/cache/lower/foo/cache-state.json\n{\"state\":{\"latest\":\"three\"}}\n```\nStart another container for `foo` cache\n```\ndocker run --rm -it --name four --volume-driver  rapt/cachedriver  -v foo-four:/data busybox sh\n/ # ls /data\nfoo-one.txt\n```\n\nInside volume container, container `four` uses `three` as lower\n\n```\n/ # mount | grep foo\noverlay on /mnt/cache/merged/foo/four type overlay (rw,relatime,lowerdir=/mnt/cache/lower/foo/three,upperdir=/mnt/cache/upper/foo/four,workdir=/mnt/cache/work/foo/four)\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuryagaddipati%2Fdocker-cache-volume-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuryagaddipati%2Fdocker-cache-volume-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuryagaddipati%2Fdocker-cache-volume-plugin/lists"}