I create a volume as follows:
>docker volume create testapp-pgdata
I see it listed as follows:
>docker volume ls
DRIVER VOLUME NAME
local 0a47653c820b1d32df3197ed0598eb0a6e7e64f0e80c4ea0461f64c345048f66
local testapp-pgdata
I start the container using the following command:
> docker-compose -f src/main/docker/postgresql.yml up -d
The yml file looks as follows:
version: '2'
services:
testapp-postgresql:
image: postgres:10.4
volumes:
- testapp-pgdata:/var/lib/postgresql/data/
environment:
- POSTGRES_USER=testapp
- POSTGRES_PASSWORD=
ports:
- 5432:5432
volumes:
testapp-pgdata:
When the container starts up I see this in the sysout:
Creating volume "docker_testapp-pgdata" with default driver
When I list the voles again I see the following:
>docker volume ls
DRIVER VOLUME NAME
local 0a47653c820b1d32df3197ed0598eb0a6e7e64f0e80c4ea0461f64c345048f66
local docker_testapp-pgdata
local testapp-pgdata
When I inspect the two volumes there is not much difference:
> docker volume inspect testapp-pgdata
[
{
"CreatedAt": "2018-08-26T09:04:34Z",
"Driver": "local",
"Labels": {},
"Mountpoint": "/var/lib/docker/volumes/testapp-pgdata/_data",
"Name": "testapp-pgdata",
"Options": {},
"Scope": "local"
}
]
> docker volume inspect docker_testapp-pgdata
[
{
"CreatedAt": "2018-08-26T09:36:32Z",
"Driver": "local",
"Labels": null,
"Mountpoint": "/var/lib/docker/volumes/docker_testapp-pgdata/_data",
"Name": "docker_testapp-pgdata",
"Options": null,
"Scope": "local"
}
]
Now the question: why is the second volume (docker_testapp-pgdata) created as a near clone of the original volume (testapp-pgdata) when the container is started?
I am running Docker version 18.06.0-ce, build 0ffa825
on windows.