项目作者: vdemeester

项目描述 :
🐳 This is an open source volume plugin that allows using an ipfs filesystem as a volume.
高级语言: Go
项目地址: git://github.com/vdemeester/docker-volume-ipfs.git
创建时间: 2016-01-30T14:57:55Z
项目社区:https://github.com/vdemeester/docker-volume-ipfs

开源协议:MIT License

下载


🐳 docker-volume-ipfs

GoDoc
Build Status
Go Report Card
License
codecov

This is an open source volume plugin that allows using an
ipfs filesystem as a volume.

  1. $ docker-volume-ipfs &
  2. $ docker run -it --rm -v QmPXME1oRtoT627YKaDPDQ3PwA8tdP9rWuAAweLzqSwAWT/readme:/data --volume-driver=ipfs busybox cat data
  3. Hello and Welcome to IPFS!
  4. ██╗██████╗ ███████╗███████╗
  5. ██║██╔══██╗██╔════╝██╔════╝
  6. ██║██████╔╝█████╗ ███████╗
  7. ██║██╔═══╝ ██╔══╝ ╚════██║
  8. ██║██║ ██║ ███████║
  9. ╚═╝╚═╝ ╚═╝ ╚══════╝
  10. If you're seeing this, you have successfully installed
  11. IPFS and are now interfacing with the ipfs merkledag!
  12. -------------------------------------------------------
  13. | Warning: |
  14. | This is alpha software. use at your own discretion! |
  15. | Much is missing or lacking polish. There are bugs. |
  16. | Not yet secure. Read the security notes for more. |
  17. -------------------------------------------------------
  18. Check out some of the other files in this directory:
  19. ./about
  20. ./help
  21. ./quick-start <-- usage examples
  22. ./readme <-- this file
  23. ./security-notes

Goals

The main goal is to be able to create docker volumes that are backed by the IPFS filesystem. They could be named volumes,
anonymous volumes. The plugin should also work in a cluster / swarm environment (but by its nature it should be built-in).

First, let’s define a “format” for creating volumes. There is two cases: docker volume create and docker run -v.

For docker volume create, it could be an option ipfs=, ipns=

  1. $ docker volume create --driver=ipfs --opt ipfs=QmPXME1oRtoT627YKaDPDQ3PwA8tdP9rWuAAweLzqSwAWT --name ipfs-welcome
  2. $ docker run -v ipfs-welcome:/ipfs/welcome busybox cat /ipfs/welcome/readme
  3. Hello and Welcome to IPFS!
  4. ██╗██████╗ ███████╗███████╗
  5. ██║██╔══██╗██╔════╝██╔════╝
  6. ██║██████╔╝█████╗ ███████╗
  7. ██║██╔═══╝ ██╔══╝ ╚════██║
  8. ██║██║ ██║ ███████║
  9. ╚═╝╚═╝ ╚═╝ ╚══════╝
  10. If you're seeing this, you have successfully installed
  11. # […]
  12. # would also work with ipns
  13. $ docker volume create --driver=ipfs --opt ipns=ipfs.io --name ipfs-io-website
  14. $ docker run -v ipfs-io-website:/var/www/html nginx

For -v directly in docker run (a.k.a. anonymous volume), we could namespace it somehow.

  1. # Default to ipfs
  2. $ docker run -it --rm -v QmPXME1oRtoT627YKaDPDQ3PwA8tdP9rWuAAweLzqSwAWT/readme:/data --volume-driver=ipfs busybox cat data
  3. Hello and Welcome to IPFS!
  4. # […]
  5. $ docker run -it --rm -v $(docker volume create --driver=ipfs --opt ipns=ipfs.io):/var/www/html --volume-driver=ipfs nginx

TODO(s)

  • Use ipfs daemon API instead of making the assumption that a daemon is running and mounting ipfs using fuse
  • Support ipfs mounts (via fuse)
  • Support ipns mounts
  • Create a volume v2 plugin