The problem here maybe is that you are not in the docker group. You can add yourself to the dockergroup with:
sudo usermod -aG docker yourusername
or you can also use
sudo usermod -aG docker $(whoami)
After this, you need to logout and log back into the server.
Alternatively, you can sudo every Docker command.
I hope it will resolve your query.