项目作者: fermayo

项目描述 :
[POC] Volume driver for Docker to mount image layers in containers
高级语言: Go
项目地址: git://github.com/fermayo/imagefs.git
创建时间: 2017-02-10T22:57:34Z
项目社区:https://github.com/fermayo/imagefs

开源协议:

下载


fermayo/imagefs

POC ONLY

Volume plugin to mount images into containers

Usage

Run the plugin as a service on a swarm:

  1. $ docker service create \
  2. --name imagefs \
  3. --mode global \
  4. --mount type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock \
  5. --mount type=bind,source=/var/run/docker/plugins,destination=/run/docker/plugins \
  6. --mount type=bind,source=/var/lib/docker,destination=/var/lib/docker \
  7. fermayo/imagefs:latest

Now you will see all your local images as volumes:

  1. $ docker volume ls
  2. DRIVER VOLUME NAME
  3. imagefs 2941e8b0086fa6140c59523fb12865461e8c6adeab50732a05a6fe4a886ef836
  4. imagefs 5745de9bbf7c7cbabbc7dee2da35ade343f59ff07ce02787a10dfaa6a935efd7
  5. imagefs 71fd841bdcb61b4e91d6d4b6df030f9371ac9dbef27e51c1a5994c38c63c7c44
  6. imagefs 7afbc2b03b9e6259c8b85457ca94490a1856d13a798ec0040c423543b66a9511
  7. imagefs 88e169ea8f46ff0d0df784b1b254a15ecfaf045aee1856dca1ec242fdd231ddd
  8. imagefs ad974e767ec4f06945b1e7ffdfc57bd10e06baf66cdaf5a003e0e6a36924e30b
  9. imagefs d34c8c7c784a39e07cd7978a4f541bde3666ced2b5b7b6c7509b161fc4a6ae64
  10. imagefs f49eec89601e8484026a8ed97be00f14db75339925fad17b440976cffcbfb88a

You can mount any image on your container:

  1. $ docker run -it -v 88e169ea8f46ff0d0df784b1b254a15ecfaf045aee1856dca1ec242fdd231ddd:/tmp:ro ubuntu cat /tmp/etc/os-release
  2. NAME="Alpine Linux"
  3. ID=alpine
  4. VERSION_ID=3.5.0
  5. PRETTY_NAME="Alpine Linux v3.5"
  6. HOME_URL="http://alpinelinux.org"
  7. BUG_REPORT_URL="http://bugs.alpinelinux.org"

Limitations

  • Does not pull layers that are not present locally in the node
  • Only mounts one layer at a time (does not mount parent layers)
  • Does not prevent writes to the image (does not have a write layer on top)
  • Only supports overlay2 graphdriver