Run Consul Docker image in kubernetes as non root Run Consul Docker image in kubernetes as non root kubernetes kubernetes

Run Consul Docker image in kubernetes as non root


I ended up in fixing Consuls docker-entrypoint.sh to check if the user is root before executing the chown command by adding some if [ "$(id -u)" = "0" ] tests.

You can find the patch on GitHub.


If /consul is an nfs mount, it might be that root_squash and all_squash are set at the server. That will result in chown operations to fail, because new files/folders will automatically be given to nobody/nogroup.

If you can change the share (temporarily) to use no_root_squash and no_all_squash until all files have been setup, you should be fine. As that filesystem typically is persisted, that should be only necessary once, so afterwards you can reset it to root_squash and all_squash again.


In case if someone looking for the solution.You can also use Consul image from Bitnami. They provide non-root images of popular apps.

docker pull bitnami/consul:1.4.4