Error "mkdir /var/lib/docker: permission denied" when creating a service

Hi,

When creating the service during a tutorial i get the following “permission denied” error.

any idea why?

root@Arend-Asus:/etc# docker service create --name psql --network mydrupal -e POSTGRES_PASSWORD=mypass postgres

eeeyc58jw8u40dxub1rzkpqag
overall progress: 0 out of 1 tasks
1/1: mkdir /var/lib/docker: permission denied

Client:
Version: 18.06.1-ce
API version: 1.38
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:24:51 2018
OS/Arch: linux/amd64
Experimental: false

Server:
Engine:
Version: 18.06.1-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.4
Git commit: e68fc7a
Built: Mon Oct 1 14:25:33 2018
OS/Arch: linux/amd64
Experimental: false

root@Arend-Asus:/etc# ls -la /var/lib/docker/
total 68
drwxrwxrwx 15 root root 4096 okt 29 09:30 .
drwxr-xr-x 68 root root 4096 okt 19 14:10 …
drwx------ 2 root root 4096 okt 7 21:26 builder
drwx------ 4 root root 4096 okt 7 21:26 buildkit
drwx------ 3 root root 4096 okt 7 21:26 containerd
drwx------ 11 root root 4096 okt 17 18:58 containers
drwx------ 3 root root 4096 okt 7 21:26 image
drwxr-x— 3 root root 4096 okt 7 21:26 network
drwx------ 57 root root 12288 okt 29 09:30 overlay2
drwx------ 4 root root 4096 okt 7 21:26 plugins
drwx------ 2 root root 4096 okt 29 09:30 runtimes
drwx------ 2 root root 4096 okt 18 10:19 swarm
drwx------ 2 root root 4096 okt 29 09:30 tmp
drwx------ 2 root root 4096 okt 7 21:26 trust
drwx------ 4 root root 4096 okt 17 18:37 volumes

I had the exact same error and I went back to how my docker installation was done. I had originally installed docked using ubuntu sudo snap install docker. I fixed the issue by re-installing docker with the officiel documentation procedure.