Skip to main content
GET
/
api
/
volumes
curl -X GET 'https://your-dockhand.com/api/volumes?env=1' \
  -H 'Cookie: session=your-session-cookie'
{
  "error": "Permission denied"
}

Overview

Returns a list of all Docker volumes in the specified environment. This endpoint requires an environment ID to be provided as a query parameter.

Authentication

This endpoint requires authentication via cookies. The user must have the volumes:view permission for the specified environment.

Query Parameters

env
integer
required
The environment ID to list volumes from. Required parameter.

Response

volumes
array
Array of volume objects

Error Responses

{
  "error": "Permission denied"
}
curl -X GET 'https://your-dockhand.com/api/volumes?env=1' \
  -H 'Cookie: session=your-session-cookie'
[
  {
    "Name": "postgres-data",
    "Driver": "local",
    "Mountpoint": "/var/lib/docker/volumes/postgres-data/_data",
    "CreatedAt": "2024-01-15T10:30:00Z",
    "Scope": "local",
    "Labels": {
      "app": "database",
      "environment": "production"
    },
    "Options": {},
    "UsageData": {
      "Size": 5368709120,
      "RefCount": 1
    }
  },
  {
    "Name": "shared-storage",
    "Driver": "local",
    "Mountpoint": "/var/lib/docker/volumes/shared-storage/_data",
    "CreatedAt": "2024-01-20T14:22:00Z",
    "Scope": "local",
    "Labels": {
      "app": "file-server",
      "tier": "storage"
    },
    "Options": {
      "type": "nfs",
      "device": ":/data/shared",
      "o": "addr=192.168.1.100,rw,nfsvers=4"
    },
    "UsageData": {
      "Size": 10737418240,
      "RefCount": 3
    }
  },
  {
    "Name": "temp-cache",
    "Driver": "local",
    "Mountpoint": "/var/lib/docker/volumes/temp-cache/_data",
    "CreatedAt": "2024-02-01T09:15:00Z",
    "Scope": "local",
    "Labels": {},
    "Options": {
      "type": "tmpfs",
      "device": "tmpfs",
      "o": "size=1G,mode=1777"
    },
    "UsageData": {
      "Size": 524288000,
      "RefCount": 1
    }
  }
]

Notes

  • Returns an empty array if no environment ID is provided
  • Volume data is retrieved directly from the Docker API
  • Requires authentication to be enabled and the user to have proper permissions
  • Enterprise users must have access to the specified environment
  • UsageData may not be available for all volume drivers
  • Volumes created by Docker Compose will include stack labels

Build docs developers (and LLMs) love