Mapping container volumes on Synology NAS
• • ☕️ 1 min readPortainer is a must-have if you’re running a homelab. Mine is running on Synology NAS. It’s not a normal desktop, so there are a few quirks I need to work around.
One of them is volumes mapping in docker.
If you inspect a docker volume on your local machine, you will see something like
[
{
"CreatedAt": "2022-04-21T21:42:30+02:00",
"Driver": "local",
"Labels": null,
"Mountpoint": "/var/lib/docker/volumes/123/_data",
"Name": "123",
"Options": null,
"Scope": "local"
}
]
As you can see, the mountpoint starts with /var/lib/docker/volumes
. Now do the same on your Synology NAS
[
{
"CreatedAt": "2022-04-22T22:28:50+02:00",
"Driver": "local",
"Labels": null,
"Mountpoint": "/volume1/@docker/volumes/123/_data",
"Name": "123",
"Options": null,
"Scope": "local"
}
]
The mountpoint startswith /volume1/@docker/volumes
! Not only that, but you need to select the correct volume.
I’m running RAID 1 so I have only volume1
at my disposal.
At last, my docker-compose file looks like this
version: "3.8"
services:
portainer:
image: portainer/portainer-ce:2.11.1
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /volume1/@docker/volumes:/var/lib/docker/volumes
- portainer_data:/data
env_file:
- .env
container_name: portainer
restart: unless-stopped
security_opt:
- no-new-privileges:true
volumes:
portainer_data:
To recap, the correct volumes mapping on Synology NAS is /volume1/@docker/volumes:/var/lib/docker/volumes
. If you wanted to map the entire /var/lib/docker
instead, just drop volumes, so /volume1/@docker:/var/lib/docker
.