4.3 Enabling Non-root Users to Run Docker Commands

Warning

Users who can run Docker commands have effective root control of the system. Only grant this privilege to trusted users.

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

  1. Create the docker group, if it does not already exist:

    # groupadd docker
  2. Restart the docker service:

    # systemctl restart docker

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

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

    # usermod -a -G docker user1
    ...