Docker Volumes explained in 6 minutes
Skills:
Docker & Containers90%
Key Takeaways
Docker Volumes are used for data persistence in Docker, and this video explains the concept, types, and usage of Docker Volumes in Docker-Compose.
Full Transcript
[Music] so in this video we're gonna learn about docker volumes in a natural docker volumes are used for data persistence in docker so for example if you have databases or other stateful applications you would want to use docker volumes for that so what are the specific use cases when you need docker volumes so container runs on a host let's say we have a database container and a container has a virtual file system where the data is usually stored but here there is no persistence so if I were to remove the container or stop it and restart the container then the data in this virtual file system is gone and it starts from a fresh state which is obviously not very practical because I want to save the changes that my application is making in the database and that's where I need docker volumes so what are the docker volumes exactly so on a host we have a physical file system right and the way volumes work is that we plug the physical file system path it could be a folder a directory and we plug it into the containers file system path so in simple terms a directory a folder on a host file system is mounted into a directory or folder in the virtual file system of docker so what happens is that when it container rights to its file system it gets replicated or automatically written on the host file system directory and vice-versa so if I were to change something on the host file system it automatically appears in the container as well so that's why when a container restarts even if it starts from a fresh state in its own virtual file system it gets the data automatically from that from the host because the data is still there and that's how data is populated on the startup of a container every time you restart now there are different types of docker volumes and so different ways of creating them usually the way to create docker volumes is using the kourin command so in the docker run there is an option called - V and this is where we define the connection of the reference between the host directory and the container directory and this type of volume definition is called a host volume and the main characteristic of this one is that you decide where on the host file system that reference is made so which folder on the host file system you mount into the container so the second type is where you create a volume just by referencing the container directory so you don't specify which directory on the host should be mounted but that's taking care of the docker itself so that directory is first of all automatically created by docker under the VAR lip docker volumes so for each container there will be a folder generated that gets mounted automatically to the container and this type of volumes are called anonymous volumes because you don't have a reference to this automatically generated folder basically just have to know the path and the third volume type is actually an improvement of the anonymous volumes and it specifies the name of that folder on the host file system and the name is up to you it just to reference the directory and that type of volumes are called named volumes so in this case compared to anonymous volumes you have you can actually reference that volume just by name so you don't have to know exactly the path so from these three types the mostly used one and the one that you should be using in production is actually the named volumes because they are additional benefits to letting docker actually manage those volume directories on the host now they showed how to create docker volumes using docker run commands but if you're using docker compose it's actually the same so this actually shows how to use volume definitions in a docker compose and this is pretty much the same as in docker run commands so we have volumes at buuuut and underneath you define your volume definition just like you would in this - B option and here we use a named volume so DB - data will be the name reference name that you can just think of it could be anything and inviolable data is the path in the container then you may have some other containers and at the end so in the same level as the services you would actually list all the volumes that you have defined you define at least volumes that you want to mount into the containers so if you were to create volumes for different containers you would list them all here and on the container level then you actually define under which path that specific volume can be mounted and the benefit of that is that you can actually mount a reference of the same folder on a host to more than one containers and that would be beneficial if those containers need to share the data in this case you would mount the same volume name or reference to two different containers and you can mount them in two different paths inside of the container thanks for watching the video I hope it was helpful and if it was don't forget to like it if you want to be notified whenever a new video comes out then subscribe to my channel if you have any questions if something wasn't clear in the video please post them in the comment section below and I will try to answer them so thank you and see you in the next video
Original Description
Understand Docker Volumes in 6 minutes. Docker Volumes in Docker-Compose
► Subscribe To Me On Youtube: https://bit.ly/2z5rvTV
In this video you will learn:
0:00 - Intro
0:21 - When do we need Docker Volumes?
1:02 - What is Docker Volumes?
2:04 - 3 Docker Volumes Types
4:14 - Docker Volumes in docker-compose file
This gives you a short but thorough understanding what Docker Volumes are.
⭐️ For a Demo please refer to https://youtu.be/SBUCYJgg4Mk
For any questions/issues/feedback, please leave me a comment and I will get back to you as soon as possible.
#devops #techworldwithnana #docker #dockertutorials
-----------------------------------------------------------------------------------
✅ Follow me
on Youtube: https://www.youtube.com/channel/UCdngmbVKX1Tgre699-XLlUA
on DEV: https://dev.to/techworld_with_nana
on Instagram: https://www.instagram.com/nanuchij/
on Twitter: https://twitter.com/Njuchi_/
on Tumblr: https://www.tumblr.com/blog/techworld-with-nana
Legal Notice:
Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries. Docker, Inc. and other parties may also have trademark rights in other terms used herein. This video is not accredited, certified, affiliated with, nor endorsed by Docker, Inc.
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from TechWorld with Nana · TechWorld with Nana · 12 of 60
1
2
3
4
5
6
7
8
9
10
11
▶
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
What is Docker? Docker container concept explained || Docker Tutorial 1
TechWorld with Nana
What is a Docker Container? Docker Demo || Docker Tutorial 2
TechWorld with Nana
How to install docker? Step by Step || Docker Tutorial 3
TechWorld with Nana
8 Basic Docker Commands || Docker Tutorial 4
TechWorld with Nana
Debugging Docker Containers with docker exec and docker logs || Docker Tutorial 5
TechWorld with Nana
Docker vs Virtual Machine | simply explained || Docker Tutorial 6
TechWorld with Nana
Overview of Workflow with Docker - Docker in Practice || Docker Tutorial 7
TechWorld with Nana
Developing with Docker - Docker in Practice || Docker Tutorial 8
TechWorld with Nana
Docker Compose Tutorial - Docker in Practice || Docker Tutorial 9
TechWorld with Nana
Dockerfile Tutorial - Docker in Practice || Docker Tutorial 10
TechWorld with Nana
Private Repository explained | Registry on AWS - Docker in Practice || Docker Tutorial 11
TechWorld with Nana
Docker Volumes explained in 6 minutes
TechWorld with Nana
Deploying the containerized application with Docker Compose || Docker Tutorial 12
TechWorld with Nana
Docker Volumes Demo || Docker Tutorial 13
TechWorld with Nana
Docker vs Kubernetes vs Docker Swarm | Comparison in 5 mins
TechWorld with Nana
What is Kubernetes | Kubernetes explained in 15 mins
TechWorld with Nana
Kubernetes Components explained! Pods, Services, Secrets, ConfigMap | Kubernetes Tutorial 14
TechWorld with Nana
Kubernetes Architecture explained | Kubernetes Tutorial 15
TechWorld with Nana
Benefits of Kubernetes | Scalability, High Availability, Disaster Recovery | Kubernetes Tutorial 16
TechWorld with Nana
Minikube and Kubectl explained | Setup for Beginners | Kubernetes Tutorial 17
TechWorld with Nana
Top 3 programming languages to learn in 2020 | meta analysis
TechWorld with Nana
Kubectl Basic Commands - Create and Debug Pod in a Minikube cluster | Kubernetes Tutorial 18
TechWorld with Nana
Kubernetes YAML File Explained - Deployment and Service | Kubernetes Tutorial 19
TechWorld with Nana
Run Jenkins in Docker Container - Jenkins Pipeline Tutorial for Beginners 1/4
TechWorld with Nana
Create Multibranch Pipeline with Git - Jenkins Pipeline Tutorial for Beginners 2/4
TechWorld with Nana
Jenkinsfile - Jenkins Pipeline Tutorial for Beginners 3/4
TechWorld with Nana
Trigger Jenkins Build automatically - Jenkins Pipeline Tutorial for Beginners 4/4
TechWorld with Nana
Complete Application Deployment using Kubernetes Components | Kubernetes Tutorial 20
TechWorld with Nana
Kubernetes Namespaces Explained in 15 mins | Kubernetes Tutorial 21
TechWorld with Nana
Configure Build Tools in Jenkins and Jenkinsfile | Jenkins Tutorial
TechWorld with Nana
Complete Jenkins Pipeline Tutorial | Jenkinsfile explained
TechWorld with Nana
Kubernetes Ingress Tutorial for Beginners | simply explained | Kubernetes Tutorial 22
TechWorld with Nana
What is Helm in Kubernetes? Helm and Helm Charts explained | Kubernetes Tutorial 23
TechWorld with Nana
How Websites Work | simply explained with examples
TechWorld with Nana
What is JavaScript? | JavaScript Tutorial #1
TechWorld with Nana
What is Ansible | Ansible Playbook explained | Ansible Tutorial for Beginners
TechWorld with Nana
JavaScript Variables & JavaScript Data Types explained | JavaScript Tutorial #2
TechWorld with Nana
How Prometheus Monitoring works | Prometheus Architecture explained
TechWorld with Nana
Where to write JavaScript | Where to execute JavaScript Code | JavaScript Tutorial #3
TechWorld with Nana
JavaScript Operators & JavaScript Conditionals | JavaScript Tutorial #4
TechWorld with Nana
Pods and Containers - Kubernetes Networking | Container Communication inside the Pod
TechWorld with Nana
Kubernetes Volumes explained | Persistent Volume, Persistent Volume Claim & Storage Class
TechWorld with Nana
Kubernetes ConfigMap and Secret as Kubernetes Volumes | Demo
TechWorld with Nana
Pull Image from Private Docker Registry in Kubernetes cluster | Demo
TechWorld with Nana
Kubernetes StatefulSet simply explained | Deployment vs StatefulSet
TechWorld with Nana
Yaml Tutorial | Learn YAML in 18 mins
TechWorld with Nana
Terraform explained in 15 mins | Terraform Tutorial for Beginners
TechWorld with Nana
Setup Prometheus Monitoring on Kubernetes using Helm and Prometheus Operator | Part 1
TechWorld with Nana
Managed Kubernetes Cluster explained | Kubernetes on Cloud (1/2)
TechWorld with Nana
Step by Step Application Deployment on LKE using Helm | Kubernetes on Cloud (2/2)
TechWorld with Nana
Kubernetes Operator simply explained in 10 mins
TechWorld with Nana
What is Infrastructure as Code? Difference of Infrastructure as Code Tools
TechWorld with Nana
AWS EKS - Create Kubernetes cluster on Amazon EKS | the easy way
TechWorld with Nana
Prometheus Monitoring - Steps to monitor third-party apps using Prometheus Exporter | Part 2
TechWorld with Nana
GitHub Actions Tutorial - Basic Concepts and CI/CD Pipeline with Docker
TechWorld with Nana
Docker Tutorial for Beginners [FULL COURSE in 3 Hours]
TechWorld with Nana
Kubernetes Services explained | ClusterIP vs NodePort vs LoadBalancer vs Headless Service
TechWorld with Nana
Kubernetes Tutorial for Beginners [FULL COURSE in 4 Hours]
TechWorld with Nana
Containers on AWS Overview: ECS | EKS | Fargate | ECR
TechWorld with Nana
Kubernetes is dropping Docker support - What does it mean for YOU?
TechWorld with Nana
More on: Docker & Containers
View skill →Related AI Lessons
Chapters (5)
Intro
0:21
When do we need Docker Volumes?
1:02
What is Docker Volumes?
2:04
3 Docker Volumes Types
4:14
Docker Volumes in docker-compose file
🎓
Tutor Explanation
DeepCamp AI