Thursday, February 27, 2025How to run Docker commands without sudo
Keven Client A. Cataluña @LinkedIn
Introduction

This guide explains how to configure Docker to run commands without using sudo by adding the current user to the Docker group.

Steps1. Create a new group named docker
    sudo groupadd docker
  
2. Verify if the docker group exists
    getent group docker
  
      docker:x:999:
  
3. Add the current user to the docker group
    sudo gpasswd -a $USER docker
  
      Adding user development to group docker
  
4. Shutdown the WSL from PowerShell (Run as Administrator)
    wsl --shutdown
  
5. Open the WSL and start the Docker daemon (service)
    sudo service docker start
  
       * Starting Docker: docker                                                  [ OK ]
  
6. List all runing Docker containers
    docker ps
  
      CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES