
Intro:
This is a really quick post for anyone wanting to manage docker deployments on a Synology using Portainer hosted elsewhere.
I have been using Portainer as my homelab container management for a few years now. I wanted to extend this management to one of my Synology NAS devices as I had plans to run a few containers on them (away from my main VMware Cluster) At present Portainer runs in a Docker VM direct on my TrueNAS box
Table of Contents
Setup
When logged into Portainer, the first thing we are going to do is add another environment. This is done by navigating to the Environment’s section. I am lucky enough to have a 5 node Business licence for this purpose.

This will navigate you to the list of existing environment’s, where you can add an additional environment

The wizard will then ask you what Environment you would like to create. In my case it will be a Docker Standalone

Once you have chosen Docker you have to name the environment and tell Portainer the address remembering the port (9001)
Portainer then gives you the command to execute on the remote environment to fire up the Portainer Agent for the Portainer server to connect to.
Issue
When I SSH into my Synology to run the commands I get the below error
sudo docker run -d \
> -p 9001:9001 \
> --name portainer_agent \
> --restart=always \
> -v /var/run/docker.sock:/var/run/docker.sock \
> -v /var/lib/docker/volumes:/var/lib/docker/volumes \
> -v /:/host \
> portainer/agent:2.27.1
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
Password:
Unable to find image 'portainer/agent:2.27.1' locally
2.27.1: Pulling from portainer/agent
436768c74267: Pull complete
d61825c69234: Pull complete
51403bd1b0cb: Pull complete
1eb0f77f2186: Pull complete
285795d2a093: Pull complete
cccbadf68541: Pull complete
3dd836c679e8: Pull complete
9da95a675496: Pull complete
92100a91b378: Pull complete
Digest: sha256:d2e6833bb6f067962f79be262066cc96921159bc9a49a3100cacecb542522fd5
Status: Downloaded newer image for portainer/agent:2.27.1
2a0dcdc5b104c35b0b030da973d7f7a6a148c24aa50db35e9ecf49dc0279fd03
docker: Error response from daemon: Bind mount failed: '/var/lib/docker/volumes' does not exist.
The Fix
This occurs as /var/liv/docker/volumes doesn’t exist on the Synology Filesystem. If we update the command as below the container starts successfully.
sudo docker run -d -p 9001:9001 --name portainer_agent --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /volume1/@docker/volumes:/var/lib/docker/volumes portainer/agent
Unable to find image 'portainer/agent:latest' locally
latest: Pulling from portainer/agent
Digest: sha256:d2e6833bb6f067962f79be262066cc96921159bc9a49a3100cacecb542522fd5
Status: Downloaded newer image for portainer/agent:latest
e770c9990d9afddbbe0098486a421421027de60d1ca324aa3af0cff10ab88ab7