The first step is to create a new directory to house the volume. I have been using Docker Desktop to enable Docker and Kubernetes in Mac for. I will assume you already have Docker up and running and can deploy containers. I’ll be demonstrating on Ubuntu Server 18.04, but the process will be the same (regardless of distribution) so long as the platform supports Docker.
Let’s find out how to deploy a new container that includes a volume attached to a specific directory on a host such that the container will stay in sync with the data in the volume. With the docker volume command, you can easily manage volumes to expand your containers well beyond their basic capability.
It is within these volumes that containers are capable of saving data. But when you need to deploy a service that requires the ability to save data (such as an application that works with a database), what do you do? Welcome to VolumesĪ Docker volume is a directory (or collection of files) that lives on the host file system and is not a part of the container’s UFS. This system functions perfectly when a container doesn’t need to save data. Docker containers make use of the Union File System (UFS), which works with a series of read-only layers that includes a final read-write layer on top. The limitation lies within the container filesystem. The name of the mount point can be the same as the mount directory, or something completely different the main constraint is that it should not conflict with. One thing you might soon discover (after taking your first few steps with Docker) is that, once deployed, your containers are limited in how they can save and contain data.
And since deploying containerized applications is so simple, you can get up to speed very quickly. With Docker containers, your company can offer applications and services on a scale and speed that you might not be able to otherwise.