Running docker commands with an user without root privileges (possibly with www-data user of Apache)

Hi All,

I am developing a simple Flask application (configured with a Apache webserver) which provides a web interface for docker management. My apache server runs as ‘www-data’ user and it uses the same for all of its API operations.

But i get the ‘Permission denied’ error for the following,
docker images
docker run, etc…
as it doesnt allow ‘www-data’ user to run the above commands.

Can you please provide me a suggestion on using the ‘www-data’ user for docker operations.

I dont want to add ‘www-data’ user to sudoers list.

Is adding the user to docker group alone will be a proper solution ???

Or please suggest me a best practice solution for this.

Thanks
GuruPrasad