On my R400 I have a script that stops all of the containers before backing up the data.

docker stop $(docker ps -a -q)

and it works. When I run the same command I get an error

sudo docker stop $(docker ps -a -q)
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json?all=1": dial unix /var/run/docker.sock: connect: permission denied
Password:
"docker stop" requires at least 1 argument.
See 'docker stop --help'.

Usage:  docker stop [OPTIONS] CONTAINER [CONTAINER...]

Stop one or more running containers

How to stop all running containers on Synology?