Docker: Error response from daemon: error while creating mount source path '/var/lib/rancher'

Hello,

Rancher installed n Ubuntu 18.04 and when I copy install code to register the host with Rancher from
http://ubuntudocker:8080/env/1a5/infra/hosts/add?driver=custom
I get this:
johnny@ubuntudocker:~$ sudo docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.2.11 http://ubuntudocker:8080/v1/scripts/A18988A45CCB4DFEDE13:1514678400000:AGyzunAuV47tKA1c85yBWQ3tfig [sudo] password for johnny: docker: Error response from daemon: error while creating mount source path '/var/lib/rancher': mkdir /var/lib/rancher: permission denied. johnny@ubuntudocker:~$

Are you using snap to install Docker? https://github.com/docker/docker-snap/issues/31

snap is no longer maintained.