MatchbookLab / local-persist

Create named local volumes that persist in the location(s) you want
MIT License
851 stars 122 forks source link

source path is not contained in array "mounts" when querying a container #102

Open gitmors opened 1 year ago

gitmors commented 1 year ago

Good day,

I have noticed that when I query information about a container via the docker API so something like this 'GET /containers/{id}/json' then I get back an object which contains among other things an array called "Mounts". In this array each volume is contained as a separate object, for example:

[{ "Destination":"/container/path", "Driver": "local-persist", "Mode":"", "Name": "test", "Propagation":"" "RW":true, "Source":"", "Type": "volume" }]

Unfortunately, the "Source":"" (source path) is not transferred here. With the default driver "local" it is. Unfortunately I need this value for one of my queries. Maybe there is a quick solution for this problem.

LocalPersist

Thank you. Regards

ThaDaVos commented 9 months ago

Running into the same issue with using OneDev Job Executor - "Source": "" - causes it to fail - but it seems, this is only empty when the volume is created through docker-compose - as I have a volume used for portainer using local-persist which has Source set - inspections of both show no obvious differences except the labels:

Portainer:

[
    {
        "CreatedAt": "0001-01-01T00:00:00Z",
        "Driver": "local-persist",
        "Labels": {},
        "Mountpoint": "{MOUNT_POINT}",
        "Name": "portainer_data",
        "Options": {
            "mountpoint": "{MOUNT_POINT}"
        },
        "Scope": "local"
    }
]

Onedev Agent:

[
    {
        "CreatedAt": "0001-01-01T00:00:00Z",
        "Driver": "local-persist",
        "Labels": {
            "com.docker.compose.project": "source-control",
            "com.docker.compose.version": "2.20.2",
            "com.docker.compose.volume": "onedev_agent_work"
        },
        "Mountpoint": "{MOUNT_POINT}",
        "Name": "source-control_onedev_agent_work",
        "Options": {
            "mountpoint": "{MOUNT_POINT}"
        },
        "Scope": "local"
    }
]