Storage in Docker
In this tutorial, we are going to discuss about Storage in Docker. To understand storage in the container orchestration tools like Kubernetes, It is important to first understand how storage works with containers.
Understanding how storage works with Docker first and getting all the basics right will later make it so much easier to understand how it works in Kubernetes.
If you are new to Docker then you can learn some basics of docker from the my docker tutorial, that is free.
There are 2 concepts comes into the docker, Storage drivers and Volume drivers plugins.
Volume drivers plugins
Now we will take a look at Volume Driver Plugins in Docker. We discussed about Storage drivers. Storage drivers help to manage storage on images and containers.
We have already discussed that if you want to persist storage, you must create volumes. Volumes are not handled by the storage drivers. Volumes are handled by volume driver plugins. The default volume driver plugin is local.
The local volume plugin helps to create a volume on Docker host and store its data under the
There are many other volume driver plugins that allow you to create a volume on third-party solutions like Azure file storage, Convoy, DigitalOcean Block Storage, NetApp, Portworx, Google Compute Persistent Disks, VMware vSphere Storage etc.
When you run a Docker container, you can choose to use a specific volume driver, such as the RexRay EBS to provision a volume from the Amazon EBS. This will create a container and attach a volume from the AWS cloud. When the container exits, your data is safe in the cloud.
$ docker run -it --name mysql --volume-driver rexray/ebs --mount src=ebs-vol,target=/var/lib/mysql mysql