Tag Archives: Docker error

[Solved] docker: Error response from daemon: could not select device driver “” with capabilities: [[gpu]].

docker uses –gpus all to report an error:

docker: Error response from daemon: could not select device driver "" with capabilities: [[gpu]].

I have searched many articles on the Internet. In summary, it is necessary to install nvidia-container-toolkitor nvidia-container-runtime(including nvidia-container-toolkit),
but the embarrassing thing is that I can’t install nvidia-container-toolkit, and it keeps showing ** E: Unable to locate package nvidia-container-toolkit **

Online solutions:

  • distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
  • curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
    Everyone should be familiar with this. Old versions of docker installation will use this to add GPG key.
  • curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.repo | sudo tee /etc/yum.repos.d/nvidia-docker.repo
    orcurl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
  • sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
  • sudo systemctl restart docker

I have tried all of the above methods. Here we should pay attention to the third step. Centos and Ubuntu commands are not the same!

I still can’t install using the above command, and the final resolution process is recorded as follows:

  • Change the system source to Ali’s mirror source
  • distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
  • curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - OK will be displayed normally
  • curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list My system is Ubuntu 18.04
  • sudo apt-get updateThis step must ensure that there is no problem. My display has several sources that are repeatedly configured, and then I sudo vim nvidia-docker.listcomment it out ( )
  • sudo apt-get install nvidia-container-toolkit

Summarize

The implementation path is the same, is it as simple as updating the source? In fact the company’s network is very poor is very unstable, resulting in many steps can not be executed properly, such as sudo apt-get updatefor a normal execution, a error.

Docker ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? [How to Solve]

I turned on centos7 today. Since I did not set the boot-up self-start, when I started docker, I found that docker-related commands would report errors. Baidu has said that I have tried reinstalling docker, but I still can’t solve the problem. Post a set of questions:

1. For example, I check the version information

 

 

 

2. Restart the container

 

 

 

3. Systemctl status docker Checking the docker status also found an error:

 

 

 

The final solution to the problem is:
1. Enter /etc/docker and create a new one without a daemon.json file:

cd /etc/docker

2. Edit the daemon.json file:
add this code:

{
“registry-mirrors”: [“https://registry.docker-cn.com”]
}

 

3. Then restart docker:

systemctl restart docker.service

[Solved] Docker ERROR: Couldn’t connect to Docker daemon at http+docker://localunixsocket – is it running?

After installing docker in ubuntu 16.04, execute in the directory where the docker-compose.yml file is located.

jing@ubuntu:/tmp/docker$ docker-compose up -d

error:

ERROR: Couldn’t connect to Docker daemon at http+docker://localunixsocket – is it running?

If it’s at a non-standard location, specify the URL with the DOCKER_HOST environment variable.

 

Solution:

The correct one is to add the current user to the docker group
jing@ubuntu:/tmp/docker$ sudo gpasswd -a ${USER} docker

Then quit the current user, switch to root for example, switch to jing again, and run docker-compose up -d and you’re done.

jing@ubuntu:/tmp/docker$ sudo su
root@ubuntu:/tmp/docker$ su jing
jing@ubuntu:/tmp/docker$ docker-compose up -d

docker: Error response from daemon: driver failed programming external connectivity on endpoint lamp

Docker containers do port mapping error
docker: Error response from daemon: driver failed programming external connectivity on endpoint lamp3 (46b7917c940f7358948e55ec2df69a4dec2c6c7071b002bd374e8dbf0d40022c): (iptables failed: iptables –wait -t nat -A DOCKER -p tcp -d 0/0 –dport 86 -j DNAT –to-destination 172.17.0.2:80 ! -i docker0: iptables: No chain/target/match by that name.
Solution
The custom chain DOCKER defined at the start of the docker service is cleared
Just restart systemctl restart dockersystemctl restart docker