Follow the given steps in an order to use docker without sudo.
Initially, add the docker group.
sudo groupadd docker
Connected user $USER
should be added to the docker group. If you do not want to utilise your current user, change the user name to match your preferred user:
sudo gpasswd -a $USER docker
either run newgrp docker
or log out and log in to make the changes and run :
docker run hello-world
If the above code run successfully then you can use docker without sudo.
Also Read:
Where is the cron log ?
How to get bash or SSH into a running docker container