By default on Debian based systems, Docker needs the sudo command to run. We can add a normal user to the Docker group so we don’t have to.
sudo usermod -aG docker username
Change out the username to your Ubuntu username.
The -a option means append the group to the username. It does not remove the user from current groups.
the -G option means add the specified group.