Skip to content

rsmoorthy/docker-volume-plugin-helloworld

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-volume-plugin-helloworld

A Hello world Docker Volume Plugin, that shows how to write a simple Docker Volume Plugin.

Look at fordemo.js for a very simple (not practical) volume plugin, only for demonstration purposes.

The app.js is a more complete Volume Plugin, that uses SSHFS for underlying filesystem, instantied from Docker through the Volume Plugin.

How to setup

  • Create a file helloworld.json and place it in /etc/docker/plugins
{
    "Name": "plugin-helloworld",
    "Addr": "http://localhost:7010"
}
  • Install SSHFS
sudo apt-get install sshfs
  • Download this volume plugin and start it
git clone https://github.com/rsmoorthy/docker-volume-plugin-helloworld.git
cd docker-volume-plugin-helloworld
npm install .
node app.js
  • Now start a docker container, and use this volume-plugin
docker run --rm -v "ssh-//user@passwd-host/":/data \
        --volume-driver=helloworld busybox ls -l /data
  • Mount in one container and share it with others. Note that the first container needs to be started, for other containers to access the files
docker run -d --name first -v "ssh-//user@passwd-host/":/data \
        --volume-driver=helloworld ubuntu

docker start first
docker run --rm --volumes-from first busybox ls -l /data
# Shows the remote files
docker stop first
docker run --rm --volumes-from first busybox ls -l /data
# Empty files
  • Unmount Issues

Please refer to Unmount Issues for an explanation of the problem faced during the Docker Meetup.

About

A Hello world for Docker Volume Plugin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published