Attaching a Docker volume to a container
We will create our first Docker volume using the following:
$ docker volume create example-volume example-volume
We will inspect the volume that we’ve just created:
$ docker volume ls --filter="name=example-volume" --format='{{json .}}' {"Driver":"local","Labels":"","Links":"N/A","Mountpoint":"/var/lib/docker/volumes/example-volume/_data","Name":"example-volume","Scope":"local","Size":"N/A"}
By inspecting the preceding volume, we see that the volume is using the local driver. A local driver is the default driver option when creating volumes. The volume data will reside on the host that Docker Engine runs. There’s also a mount point to our local filesystem. This is where the data in this volume resides physically on the host.
Since we created the volume, we...