How can I restart docker daemon running in rootless mode on Linux?
Stopping it works fine with:
systemctl --user stop docker.service
but starting it back again fails when using:
systemctl --user start docker.service
The command doesn't return anything but when checking the docker info
it says:
ERROR: Cannot connect to the Docker daemon at unix:///run/user/1000/docker.sock. Is the docker daemon running?
It doesn't give any further information...
I had this error a couple of times before, when I accidentally run docker with sudo and therefore got mixed up permissions in my data-root
(defined in daemon.json). But this time chowning it back to $USER didn't help with the restart. Also restarting the host machine didn't help (as it did a couple of times previously).
Ok, it seems that "userns-remap" is not compatible with rootless mode:
I was trying to fix permission issues on shared volumes by experimenting with setting UIDs/GIDs and added "userns-remap" to the ~/.config/docker/daemon.json:
So deleting userns-remap from the config file fixed the restarting issue... Man, docker, at least a hint to the config file would be great... Because the
userns-remap
option was mentioned on some official docker doc pages I didn't even consider it as the source of the trouble in the first place.