Enabling Non-root Users to Run Docker Commands on Cent OS, Oracle and Red hat Linux


The following procedure applies to version 1.5 and later of Docker.

To enable users other than root and users with sudo access to be able to run Docker commands:


Create the docker group:

# groupadd docker
Restart the docker service:

# service docker restart
The UNIX socket /var/run/docker.sock is now readable and writable by members of the docker group.

Add the users that should have Docker access to the docker group:

# usermod -a -G docker testuser

Now logout the user account and login back (or) exit from the terminal and login back


Note:
  1. Users who can run Docker commands have effective root control of the system. Only grant this privilege to trusted users.
  2. Add sudo as a prefix to the above commands, when executing them through non root user who has sudo privilege

Post a Comment

0 Comments