InterviewSolution
| 1. |
Explain different types of volume mounts in docker. |
|
Answer» There are three mount types available in Docker
Starting with Docker 17.06, -v or --volume flag and --mount flag could be used for docker SWARM services and standalone containers. To create a docker volume. For EG: “docker volume create my-vol” creates new volume “my-vol”. We can inspect a volume with the command “docker volume inspect” For eg: “docker volume inspect my-vol “ gives the output [ { "DRIVER": "local", "Labels": {}, "Mountpoint": "/var/lib/docker/volumes/my-vol/_data", "Name": "my-vol", "Options": {}, "Scope": "local" } ]If we need to start a container with “my-vol”
“docker run -d --name devtest -v my-vol:/app nginx:latest”. Here nginx images with the latest tag are executed with using volume mount “my-vol”
“docker run -d --name devtest --mount \ source=my-vol,target=/app nginx:latest”
|
|