What is Docker Volume | How to create Volumes | What is Bind Mount | Docker Storage
ฝัง
- เผยแพร่เมื่อ 8 ก.ค. 2018
- 11:26 Bind mount
More about Raghav - automationstep...
Today we will learn:
1. What are Volumes
2. How to create / list / delete volumes
3. How to attach volume to a container
4. How to share volume among containers
5. What are bind mounts
Volumes are the preferred mechanism for persisting data generated by and used by Docker containers
: docker volume //get information
: docker volume create
: docker volume ls
: docker volume inspect
: docker volume rm
: docker volume prune
Instead of deleting containers one by one of docker ps -a , we can use docker container prune. and for docker ps (running containers) we can use docker rm $(ps -aq)
Use of Volumes
===========
Decoupling container from storage
Share volume (storage/data) among different containers
Attach volume to container
On deleting container volume does not delete
Commands
docker run --name MyJenkins1 -v myvol1:/var/jenkins_home -p 8080:8080 -p 50000:50000 jenkins
docker run --name MyJenkins2 -v myvol1:/var/jenkins_home -p 9090:8080 -p 60000:50000 jenkins
docker run --name MyJenkins3 -v /Users/raghav/Desktop/Jenkins_Home:/var/jenkins_home -p 9191:8080 -p 40000:50000 jenkins
References
hub.docker.com...
docs.docker.co...
NOTES
By default all files created inside a container are stored on a writable container layer
The data doesn’t persist when that container is no longer running
A container’s writable layer is tightly coupled to the host machine where the container is running. You can’t easily move the data somewhere else.
Docker has two options for containers to store files in the host machine
so that the files are persisted even after the container stops
VOLUMES and BIND MOUNTS
Volumes are stored in a part of the host filesystem which is managed by Docker
Non-Docker processes should not modify this part of the filesystem
Bind mounts may be stored anywhere on the host system
Non-Docker processes on the Docker host or a Docker container can modify them at any time
In Bind Mounts, the file or directory is referenced by its full path on the host machine.
Volumes are the best way to persist data in Docker
volumes are managed by Docker and are isolated from the core functionality of the host machine
A given volume can be mounted into multiple containers simultaneously.
When no running container is using a volume, the volume is still available to Docker and is not removed automatically. You can remove unused volumes using docker volume prune.
When you mount a volume, it may be named or anonymous.
Anonymous volumes are not given an explicit name when they are first mounted into a container
Volumes also support the use of volume drivers, which allow you to store your data on remote hosts or cloud providers, among other possibilities.
#DockerVolume #DockerBindMount #DockerContainers #DockerTutorials #DockerTraining #DevOpsTools #DevOpsTraining #DockerCommands #DockerForBeginners #DockerFreeTutorials #DockerforDevOps
DOCKER PLAYLIST
• Docker
TH-cam PLAYLIST
/ @raghavpal
TH-cam
/ automationstepbystep
FACEBOOK
/ automationstepbystep
TWITTER
/ automationsbs
If you like videos on the channel Automation Step by Step, hit the like button and share with others.
Click the SUBSCRIBE button and hit the bell icon to keep getting new videos.
_______ ONLINE COURSES TO LEARN _______
Visit - automationstepb...
----------- Follow -----------
TH-cam - / automationstepbystep
Share your knowledge with everyone and,
Never Stop Learning
Raghav
I am a student currently learning Docker and have struggled to find clear explanations about Docker volumes. Your video is very clear, your voice is easy to understand, and as a thank you, I am now following you. Thank you again and again! i will be sharing your channel and your website with my colleagues too !!
You're very welcome Heshan.. humbled
Much appreciate with some simple but to-the-point examples! You are a really good teacher!
Glad it was helpful
All of your tutorial with docker is easy to understand and easy to digest. Thank you for making this. This helps a lot.
You're welcome Angelo
This is very easy and good explanation Raghav. You represent things in simple way. I really appreciate. Instead of deleting containers one by one of docker ps -a , we can use docker container prune. and for docker ps (running containers) we can use docker rm $(docker ps -aq).
Thanks for adding Saurabh
Thank you. By far the most easy to follow explanation I've come across.
Most welcome Gautam.. humbled
Thank you very very very much for the lesson. What I like the most about your videos is that you teach in a calm and relatively slow pace. Which in my opinion is the key for successful learning. I send you love and blessing. Big like and subscribe from me. 🌻
Thanks a lot Rami.. humbled
Wonderful explanation. I was really looking for such kind of video, easy, practical, and live with all the details.
Thank you very much. Keep posting more videos.
You're welcome Nawal.
the only resource on the internet that did not throw an error--including the documentation. thanks!
Glad to know it helped Ethan
After reading tons of info and still confused,this video really helped. Thanks a lot.
Happy to know this Ranjith
You are more than a teacher. I am glad I found you. Thank you so so so much.
Thanks Mukesh, humbled by your message
Perfect! Understood docker volume in 15 minutes. Thanks a lot!
You are welcome Ramesh
took me 15.07 mins
Super, all of your tutorial with docker is easy to understand and easy to digest.
Great to hear this Samuel
Thank you very much for this tutorial am very new to docker and learning the concept one by one, your tutorial is more helpful to learn docker.
Most welcome Vinoth
Easy, simple informative video thank u sir
Most welcome Prithviraj
As always Raghav awesome. I already “know” you a few years and you never disappoint
Thanks a ton J Semblano.. humbled
very simple ....yet powerful explanation.
Thanks Maaz
Very well explained for the beginners. Thank you Raghav
Thanks and welcome Mazharul
Thanks for putting this video together. Clear and to-the-point. Keep up the good work!
Glad it was helpful Nawaz
Very easy to understand tutorial.. 👌.
I guess the problem with using port 70000 is exceeds the max allowed port no of 65535, which is a networking stipulation
thanks for sharing Shantharam
Real quality videos with precise and clear explanation. I am grateful for these videos as they teach me so much in mere few minutes. Thanks a ton brother.
You're welcome Harshil
My god, I've been struggling with the binds for days! Thanks, I now finally get it. I'm an absolute docker beginner.
Glad I could help Leon
Your way of explanation is great. Providing notes in the video description section is very helpful. Thanks for enlightening us with your knowledge.
Glad it was helpful Prasenjit
Thank you so much for explaining about volume mapping in containers with hands on. Helped me a lot to understand easily. Can you also explain how this volume mapping is handled at the time of autoscaling the containers?
Sure Nisha, will add more tutorials
Thanks Raghav! You have explained the concept clearly and succinctly.
Glad it was helpful!
this video is very informative. very well explained for begineers. thanks
You're very welcome Prashanth
perfect run through... even learned a mac feature (splitscreen )
Great to know Philip
It reads like a Coconut-pie recipe my old granny used to have in her kitchen drawer ....I had to be a very good boy to get some of that pie - thank you so much!
So glad to read this . Thanks
Very nice tutorial 👍. Simple & elegant. Thnks for making such useful tutorial 👍. Really learned a lot😀
So nice of you Abhirup
Man, your job is VERY VERY helpful. I'm developer with about 6+ years of real development. But tranding shit like CI/CD or Docker is too magical for someone who is reviewing all packets before installing, who is managing environment with static Ip addresses, who thinks before making update.
Happy to know it helped Ilyas
A very good series. Thank you very much for sharing your knowledge.
Glad you enjoyed it Anura
Very well explained with simple use cases
Glad it was helpful Manoj
You explained very precisely. Really appreciated. But I have one concern here how can we will get our deleted container data.
Hi Shibasis, I have not tried, here is some information on this - stackoverflow.com/questions/29202787/restore-deleted-container-docker
one of the best content over internet on docker volumes.
Happy to see this Prabhu
Very simple explanation with examples. Also if you can add networking module in addition will indeed help
Hi Anand, I will check that soon
This made understanding volumes crystal clear, much appreciated.
You're welcome Allen
I like all of your videos... It's really very easy n interesting to understand compared to other over rated channels like edureka.. thanks a lot sir!!
So happy and humbled to see your message Deepti.
Almost I learned basic .. today... Thank you very much !! Raghav
You're welcome, keep learning.
thanks a million for the explanation and making a vid on this, really helped my understanding
You're welcome Charlie
The way you explain things is amazing! :)
Thanks Anna
Simple and practical approach with all the necessary explanation to understand the concept fully. Good Job! Thanks..
Glad it was helpful Fahad
Sir, you made this video since 2018 and its really helpful for me in 2020. Thank you so much from the heart
You're most welcome Adam, I will also be created latest videos. Check all here - automationstepbystep.com/
Automation Step by Step - Raghav Pal i really want to learn Docker and Jenkins. I purchased a course from Udemmy, but was really hard to understand. Your way was amazing, I really got it from the first time. Your Jenkins and Docker courses are Kinda old? Do you have somewhere courses. I hope you have a Udemmy course. Please let me know. Much appreciated Adam
Automation Step by Step - Raghav Pal I think I can see your courses on Udemmy. But I think Jenkins is old and I am not even able to install it on my Mac. However, can I get a promotion code for Docker course. Thank you
Hi Adam, I will be creating Jenkins and Docker Udemy courses in some time.
If you need to remove all running docker process in a single shot, You can use this command line.. docker rm -f $(docker ps -aq) . BTW, nice video..
Thanks Arul
Thank you very much for this wonderful tutorial. Very Easy Very Informative.
Love from Pakistan.
Most welcome Ateeq
This tutorial is fantastic! Concise and to the point!
Glad it was helpful Merin
Thank you so much. Best explanation ever!
You're very welcome!
I'm really like your videos. It's very clear and helpful. Thanks for your videos.
You are welcome!
Hi Raghav, really you made my day Hatsoff to your explaination.
So happy to know this Ashok
You are awesome raghav, to the point. No extra talk. Thanks for the video.
Thanks a lot. Humbled
Your explanation is very easy to understand and informative! Thank you!!
You're most welcome Hiroyuki
great job! i will share this to my colleagues
Awesome, thank you Richard
Excellent, now I found a new favourite tech channel
Happy to know Akinjide.
Best wishes,
Raghav
Thanks so much, this is exactly what I needed to know!
You are so welcome Clara
Love you Raghav! God bless you kind sir!
Thanks a lot Nasir
Excellent Raghav!! You explained it very well with practical example. You Rock Man!! Waiting for more such like videos.
Sure Nikhil, thanks for watching
Very good job Raghav. Congratulations !! Very well explained . Thanks a lot
Most welcome Enrico
Amazing walkthrough. Loved it✌
thanks Manoj
Just wanted to thank you Raghav Patel
You're welcome Kevin
for newbies, maximum port number can be 65535
Thanks for adding Rajesh
Very useful explanation. Thank you very much!
You're welcome Bernd Glückert
Wow.. you easily explained it in detail. Excellent video!
Glad you liked it Farrukh
Thanks Raghav,well explained..
Most welcome Vijay
Wonderful explaination sir. Thank you soo much.It helped me a lott
You are most welcome Pradeep, Do follow other sessions and let me know if you face any issue
Very nice explanation
Thanks for watching Shashank
My preferred teacher 🤗
Thanks a lot
Thank you so much, I keep learning from you. Thanks, a lot.
So nice of you Naing Lin
Really useful tutorial! Thank you!
Most welcome
I like your videos so much sir good explaination
Thanks and welcome
Thanks Ragav for sharing video..
i have one doubt
when we say docker volume create .. where this volume will be created ?
is that volume avaiable in our local machine ..where this volume stored ?
Also is there any other types of volumes avaiable to make container persistant ..?
And how about Kubernetes volume works and where it is stored the volumes when we create volume using peristantvolumeclaim files
kindly explain
Thanks in adavnce..
Hi Jashva, I believe I discussed breifly on that and also volume and bind mounts. You can check more online and I will plan to add a separate session soon
As usual, an excellent tutorial - huge thanks for the video!!!
I though that through the creation of a volume through the `docker volume create volume_name` command - but using some option - would be possible define its path - but seems is not possible and docker always uses the '/var/lib/docker/volumes//_data' path
A cold beer to you friend!
Hi Manuel, thanks for watching
Very well explained the concept of volume and bind mount.. Thanks a lot
Most welcome Suhas
Its Excellent Teaching and your videos
So nice of you Gopal
Amazing. Thanks for the practical examples.
You're welcome Mazhar
Thanks a lot i have been struggling to mount a volume on a windows machine the last bit saved me Great Content!
You're welcome Ezra
I have watched your docker videos twice 😍 waiting for advanced docker tutorials :)
So happy to know this Harsha, I will do Advanced Docker. Cannot say a specific time, as I am engaged with multiple things, but will do it surely. Keep yourself subscribed to get notifications
Great explanation sir.
Thank you😊
Most welcome Pankaj
Excellent mostly at ending sharing key points shows u r 💖 love at work ...
Thanks for the message .
thank you , ı understant volumes easy with this video
Most welcome
Hi Raghav,
I followed all your Git , Jenkins, Docker can you create an application or a small program upload to git integrate with jenkins and use docker for deployment on any server that would be more helpful and can add more sense to understand the complete flow from end to end
Hi Ravankol, I will do it in some time
Hi! That was absolutely simple yet interesting, thank you for making that vid I was able to understand volume more now. Out of question but, can you try making a vid using volume in docker-compose? Thank you!
Happy to know that Chen, I will try after some time.
Thanks for a very fast, clear and informative tutorial : )
Q: Can the volume be a cloud storage bucket from a cloud provider like Google, So that a newly created container can read from it?
If Yes y not make a video demonstrating using cloud volumes..
I subscribed after watching first few minutes of this video..
Yes you can Adithya, I will plan a session
The answer to that question is yes it can, which is why volumes are so convenient to use. They can be stored on the cloud and volumes can be shared by multiple containers. The Docker website has some good information on this. I'd suggest going to their site and reading up on Docker Volumes so you can get a good understanding of this.
Simple and very easy to understand! Thanks!
You're welcome Gaurav
Great content.. especially loved the "recap" credits with music at the end.
Glad you enjoyed it Kenny
Beautiful tutorial run! Many thanks
Excellent tutorial on Docker Volumes!
So happy to know this Andrew
Hi !! This was the most amazing tutorial on Dockers, Thanks a ton :)
You're welcome Rajdeep. Happy and Humbled to see your message
u are amazing explaining. thanks man
You're welcome Tareq
Superb. Very Simple explanation. keep up the good work.
You're welcome Nitin
Great explanation. Thanks a lot.
You are welcome Avijit
just wonderful. very well explained. Thank you.
You're welcome Nergalgreed
Hands down just amazing (the music)... and the teaching too ;)
Thanks for the kind words
Very good explanation , I have a course on udemy, but you explained better.
Glad it was helpful Diptesh
Thanks a lot for such a nice explanation
You are most welcome Ambika
Awesome explanation, please keep uploading more content on devops tools :)
Sure I will Poonam
Thanks for this wonderful video
Most welcome Shankar
Brilliant video. Thank you
Very welcome
Informative and easy to understand
CHeers :)
Glad it was helpful Veeresh
Great work! Clear & simple. This helped me
Happy to know that
Very detailed video. You have explained it in a very simplified manner. :)
Thanks for watching Sai
Thank you so much .Very helpful
Glad it was helpful Robbin
Oh man... what an excellent explanation...! Thanks!
You're welcome Arturo