Out of the box for a Docker install on CentOS 7, you have to sudo the docker command to interact with Docker. Per the post-install steps here, create a docker group and add your user to that group:
sudo groupadd docker sudo usermod -aG docker youruser
Logging off and back on again, you should now be able to run the docker command without sudo.
On CentOS 7 this still didn’t work for me. Following this post, it appeared that docker.sock was owned by root and in the group root:
$ ls -l /var/run/docker.sock srw-rw---- 1 root root 0 Oct 21 15:42 /var/run/docker.sock
Changing the group ownership:
$ sudo chown root:docker /var/run/docker.sock $ ls -l /var/run/docker.sock srw-rw---- 1 root docker 0 Oct 21 15:42 /var/run/docker.sock
After logging back on, now can run docker commands without sudo.