Skip to content

Instantly share code, notes, and snippets.

@kudaliar032
Created January 25, 2020 09:11
Show Gist options
  • Save kudaliar032/05783bb095cfa1aaf4798a5f5ca023e6 to your computer and use it in GitHub Desktop.
Save kudaliar032/05783bb095cfa1aaf4798a5f5ca023e6 to your computer and use it in GitHub Desktop.
# LAB3 | Docker Volume
docker volume -h
docker volume ls
## Create Volume
docker volume craete test-volume1
docker volume create test-volume2
## Volume Commands
docker volume inspect test-volume1
docker volume rm test-volume1
docker volume prune
## Mount Volume Into Container
docker volume create test-volume
docker run -d --name nginx-volume1 -v test-volume:/usr/share/nginx/html -p 8000:80 nginx
docker volume inspect test-volume
sudo su -
cd /var/lib/docker/volumes/test-volume/\_data
vim index.html
docker stop nginx-volume1
---
mkdir volume
cd volume
mkdir target
docker run -d --name nginx-volume2 -v $PWD/target:/usr/share/nginx/html -p 8000:80 nginx
cd target
vim index.html
docker stop nginx-volume2
## Volume Driver
### sshfs
docker plugin install --grant-all-permissions vieux/sshfs
docker volume create --driver vieux/sshfs -o sshcmd=adit@localhost:/home/adit -o password=adit ssh-volume1
docker run -it --name ubuntu-volume -v ssh-volume1:/adit --rm ubuntu:18.04 bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment