Storage Flashcards

1
Q

Storage location of non-persistent data

A

/var/lib/docker/Storage-driver/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Third party drivers for persistent volumes

A
  • block storage(amazon efs, open stack cindr) good for high performance
  • file storage (uses protocol such as nfs, smb) good for high performance workloads
  • object storage - large blobs that do not often change (amazon s3, sef, mino)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Storage location of persistent data

A

/var/lib/docker/volumes/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

List all Docker volume commands

A

docker volume -h

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

List all volumes

A

docker volume ls

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Create volume

A

docker volume create volume_name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Get the flags available when creating a volume

A

docker volume create -h

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Inspecting a volume

A

docker volume inspect volume_name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Deleting a volume

A

docker volume rm volume_name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Removing all unused volumes

A

docker volume prune

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Bind mounts with mount flag type=bind

they are not managed by __docker volume__

A

docker container run -d –name container_name –mount type=bind,source=source,target=target_in_container image_name
example:
1. mkdir my_target
2 .docker container run -d \
–name nginx-bind-mount1 \
–mount type=bind,source=”$(pwd)”/me_target,target=/app nginx
3. touch my_target/file1
4. docker container exec -it nginx-bind-mount1 /bin/bash
5. ls /app => file1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Bind mounts with volume flag

A

docker container run -d –name container_name –volume:source:target image_name
example:
1. docker container run -d –name nginx-bind-mount2 \
-v “$(pwd)”/my_new_target:/app nginx
creating my_new_target prior running a container is not necessary, this will be created automatically
2. docker container exec -it nginx-bind-mount2 touch /app/myfile
3. ls ~/my_new_target/ => myfile

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Bind mounts with mount flag type=volume

they are managed by __docker volume__

A
docker container run -d --name container_name --mount type=volume,source=source,target=target_in_container image_name
1. docker volume create html_volume
2 .docker container run -d \
  --name nginx-volume1 \
  --mount type=volume,source=html_volume,target=/usr/share/nginx/html/ \
nginx
3. docker volume inspect html_volume
4. Creating a volume using that volume flag
docker container run -d \
 --name nginx-volume2 \
 -v html_volume:/usr/share/nginx/html/ \
 nginx
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Using a read-only volume:

A
  1. docker run -d \
    –name=nginx-volume3 \
    –mount source=html_volume,target=/usr/share/nginx/html,readonly \
    nginx
  2. docker container exec -it nginx-volume3 /bin/bash
  3. vim /usr/share/nginx/html/index.html => this is read only
How well did you know this?
1
Not at all
2
3
4
5
Perfectly