By default, running Docker commands requires administrator privileges (using 'sudo'). For convenience and to avoid constantly typing 'sudo', you can run Docker commands as a non-root user. This guide shows you how to achieve this on Ubuntu.

Creating the Docker Group

  • Docker installs a group called 'docker' during installation. If it's not already present, create it using:

    sudo groupadd docker

Adding Your User to the Docker Group

  • Add your user to the 'docker' group with the following command. Replace 'username' with your actual username:

    sudo usermod -aG docker username
  • Log out and log back in so that your group membership is re-evaluated.

  • Verify that you can run Docker commands without 'sudo' by typing:

    docker run hello-world


  • Adding a user to the 'docker' group grants them elevated privileges equivalent to the root user for Docker operations.

  • This approach should be used cautiously, especially on multi-user systems, as it can pose security risks.


Allowing Docker commands to be executed without 'sudo' can streamline your workflow, but it's important to understand the security implications. Only trusted users should be added to the 'docker' group to prevent unauthorized access to Docker and the host system.

Was this answer helpful? 0 Users Found This Useful (0 Votes)