Skip to content

Storage & Volumes

Surya Vallabhaneni edited this page Sep 16, 2019 · 1 revision

Docker Storage

storage driver on centos

DeviceMapper(DM) on EE, VFS, DM on CE

storage driver on ubuntu

aufs3, DM, overlay, fs

which storage driver works at file level than block level

aufs, overlay, overlay2

which storage driver works at block level than file level

deviceMapper, btrfs,zfs

which performs better(overlay or overlay2)

for workloads necessiating many small writes or containers with many layers or deep filesystems, overlay may perform better than overlay2

Storage Layers: Every layer except for the last is a readonly layer

TRUE

What is docker's storage strategy

Copy-On-Write

"Anytime a container is deleted, any data that is written to container read/write layer that is not stored in data volume, will be deleted along with the container"

TRUE

What are the types of Volume Drivers

"1. Local Volume Driver 2. Cloud Storage Volume Driver"

create a docker volume

docker volume create my-mount

list all volumes

docker volume ls

inspect a volume

docker volume inspect my-mount|more

create a service with volume

docker service create --name <cont-name> -p 80:80 --mount source=my-mount,target=/internal-mount --detach=false --replicas 3 <image>:<tag>

create a volume in worker node's container

docker service create --name <cont-name> -p 80:80 --mount type=bind,source=my-mount,target=/internal-mount --detach=false --replicas 3 <image>:<tag>

remove a volume

docker volume rm <volume-name>

prune all volumes

docker system prune -a --volumes

"Docker supports several different storage drivers, using a pluggable architecture (TRUE/FALSE)"

TRUE

how to configure device-mapper

in /etc/docker, put {"storage-driver":"devicemapper"}

when using with services, which option should be used (-v or --mount)

--mount

Clone this wiki locally