How to give docker user docker.sock permissions

Hey guys.

We have a container that acts as a management system (rundeck), and the container runs as a default user it creates.

We need to run docker commands inside the container. An option that works, is by bind mounting /var/run/docker.sock and setting the permissions for "others" to read and write, but obviously this isn't the best solution as it gives everyone the permission to read and write.

I tried to follow, where in the Dockerfile, I basically delete the generated user, and re-create the user by mounting my user id to the user's user id. The issue is that the image doesn't support userdel and other linux commands needed to make this work.

Is there a way we can add a docker created user, into our docker group in the host machine? Or at this point, would we have to result to installing in our container?

submitted by /u/benaffleks
[link] [comments]
Source: Reddit