Use Volume Driver on Docker

We will use volume driver on Docker

network graph
Network topology

I use two instance for volume driver

SSH to pod67-node1 floating IP from pod67-node0

ssh -l ubuntu 10.1.1.13

create /share directory

sudo mkdir /share

change directory permission

sudo chmod 777 /share

exit from pod67-node1

exit

Install plugin sshfs

sudo docker plugin install --grant-all-permissions vieux/sshfs

View plugins

sudo docker plugin ls

Disable plugin

sudo docker plugin disable [PLUDIN ID]

Set plugin

sudo docker plugin set vieux/sshfs sshkey.source=/root/.ssh/

Enable plugin

sudo docker plugin enable 86d094668892

View plugins

sudo docker plugin ls

Create volume with driver sshfs

sudo docker volume create — driver vieux/sshfs -o sshcmd=root@10.1.1.13:/share -o allow_other sshvolume

run container with volume

sudo docker run -d — name=nginxtest-ssh -p 8090:80 -v sshvolume:/usr/share/nginx/html nginx:latest

SSH to pod67-node1

ssh -l 10.1.1.13

Add text to file index.html

sudo sh -c "echo 'Hello, I am hakim' > /share/index.html"

See index contents

sudo cat /share/index.html

exit from pod67-node1

exit

Docker ps

sudo docker ps

test the container

This is my little notes based my experiment and my learning. Keep learning and keep calm.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store