Executing the command in the docker image displays: You requested GPUs: [0] But your machine only has: []

Table of contents

Problem Description:

problem solved:


Problem Description:

In the docker image environment, execute "docker exec -it container_name /bin/bash" to enter the container, execute the corresponding python command, and it will display You requested GPUs: [0] But your machine only has: [].

The server is a host machine and has GPU resources. However, when running the docker image environment on the server, no available GPU resources can be found.

problem solved:

The problem lies in that when loading the docker image, the docker image is not informed and the GPU resources of the host can be used directly.

Different from the execution command above, just change the execution command.

1. Use the following command to view all container status:

docker ps

e.g.,

2. Based on the IMAGE name obtained in step 1, execute the command:

! ! ! --gpus all indicates the host's GPU resources, which are available to docker.

docker run --gpus all -it <IMAGE_ID_OR_NAME> /bin/bash

Referring to the above example, the corresponding execution command should be:

docker run --gpus all -it 6793774e3933 /bin/bash

Guess you like

Origin blog.csdn.net/weixin_41862755/article/details/132848797