Running sudo
inside a Docker container produces the error
sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?
Permissions for sudo
are set correctly:
-rwsr-xr-x 1 root root 149080 gen 18 2018 /usr/bin/sudo
Also, the root filesystem is not mounted as nosuid
. (mount | grep nosuid
does not include /
as a mount point.)
What could be wrong?
Best Answer
According to this GitHub post by asbe,
(Emphasis added by me.)
Indeed, I was mounting
/var/lib/docker
from another drive with thenosuid
option enabled. I disablednosuid
with this command:Then
sudo
worked after restarting the container.