The latest version of docker19.03 support seamless nvidia graphics card and container, to get rid of the nvidia-docker dependent. So do not hesitate to install version 19.03 of docker, installation guide refer to the official course the Get Docker Engine - Community Community for CentOS , but also to solve a problem after installed is how to make non-root user has the right to use docker.
In fact, by /var/run/docker.sock user is interacting with the docker container, so to get the right to use the docker must have read and write access to /var/run/docker.sock this file, use the stat command to view / var / basic information of run / docker.sock this document
You can see the root and docker group of docker.sock have the right to read and write, then the non-root user just become docker group in one can have read and write access to docker.sock, the specific steps given below:
Create a docker user groups, in fact, will automatically create a user group named docker docker during installation, you can view the presence of / etc / group confirmed docker user group, if it does not exist, manually create a docker User Group
sudo groupadd docker
Add this to the non-root user group docker
sudo gpasswd -aG docker $USER
The current non-root user group to switch to user groups docker
newgrp docker
Execution docker image ls verify whether the current non-root user obtains the right to use a docker, it will be authorized to print a local mirror, or disable access to the display /var/run/docker.sock
docker image ls
Reference links: