Docker using non-root users
Usually we use root when using Docker, the official statement is as follows:
The Docker daemon binds to a Unix socket instead of a TCP port. By default, Unix socket is owned by the user root and other users can access it with sudo. For this reason, Docker Daemon always runs as the root user.
To avoid the Docker command, create a Unix group called Docker and add users to it. When the Docker daemon starts, it makes the ownership to the Unix socket read/writable by the Docker group.
The following is a procedure to create a docker group using a non-root user action
sudo groupadd Docker
Add the current user to the Docker group
sudo gpasswd-a ${user} docker
Restart the Docker service (below is the CentOS7 command)
sudo systemctl restart Docker
The current user exits the system and logs back in
Run Docker command
Docker PS
Reprint please indicate this link form link
This article link: http://blog.csdn.net/kongxx/article/details/52413332