Error installing Portainer agent

When running the following

~$ 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 \
  portainer/agent:2.18.1

I get: docker: Error response from daemon: error while creating mount source path ‘/var/lib/docker/volumes’: mkdir /var/lib/docker: read-only file system.

I thought “sudo” would have addressed the permissions issue.

Make sure you have done the prerequisites

1 Like