我想在执行命令时阐明“设备”和“安装点”的含义
docker volume inspect
在Postgres容器中。我在test_postgresdb_vol_2
中手动创建了/user/data/test_postgresdb_vol_2
文件夹来存储来自容器的持久数据,但是现在我很困惑,因为我有两个不同的路径。你能说明发生了什么,什么意思“设备”路径和“安装点”路径。
体积检查示例:
[
{
"CreatedAt": "...",
"Driver": "local",
"Labels": {
"com.docker.compose.project": "test",
"com.docker.compose.version": "1.22.0",
"com.docker.compose.volume": "pgdata"
},
"Mountpoint": "/var/lib/docker/volumes/test_pgdata/_data",
"Name": "test_pgdata",
"Options": {
"device": "/user/data/test_postgresdb_vol_2",
"o": "bind",
"type": "none"
},
"Scope": "local"
}
]
docker-compose示例:
postgres:
container_name: postgres
image: postgres
volumes:
- pgdata:/var/lib/postgresql/data
environment:
...
PGDATA: /var/lib/postgresql/data/pgdata
volumes:
pgdata:
driver: local
driver_opts:
o: bind
type: none
device: /user/data/test_postgresdb_vol_2