gpt4 book ai didi

python - docker :来自守护进程的错误响应:未能创建垫片

转载 作者:行者123 更新时间:2023-12-04 18:24:39 25 4
gpt4 key购买 nike

在新的 ubunto 上,我安装了 docker,当我运行镜像时,出现以下错误

docker: Error response from daemon: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "--gpus": executable file not found in $PATH: unknown.
ERRO[0000] error waiting for container: context canceled
这就是我准备系统的方式
sudo apt updat
sudo apt full-upgrade
sudo apt autoremove
#通过软件和更新安装gpu驱动
sudo apt install nvidia-cuda-toolkit
sudo apt install docker.io
#这里是docker文件
FROM python:3
WORKDIR /workspace
COPY test.py /workspace
RUN pip install torch==1.7.1+cu101 torchvision==0.8.2+cu101 torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html
CMD ["python", "./test.py"]
#这里是test.py文件
import torch
print('testing')
print(torch.cuda.get_device_name(0))
print(torch.cuda.is_available())
print(torch.cuda.current_device())
print(torch.cuda.device_count())
print('gpu')
nvcc --版本
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:07:16_PDT_2019
Cuda compilation tools, release 10.1, V10.1.243
英伟达-smi
-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.57.02 Driver Version: 470.57.02 CUDA Version: 11.4 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA GeForce ... Off | 00000000:01:00.0 On | N/A |
| N/A 64C P0 24W / N/A | 513MiB / 6069MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
uname -r 5.8.0-63-generic
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
docker version
Client:
lient:
Version: 20.10.2
API version: 1.41
Go version: go1.13.8
Git commit: 20.10.2-0ubuntu1~20.04.3
Built: Fri Jul 23 21:06:26 2021
OS/Arch: linux/amd64
Context: default
Experimental: true

Server:
Engine:
Version: 20.10.2
API version: 1.41 (minimum version 1.12)
Go version: go1.13.8
Git commit: 20.10.2-0ubuntu1~20.04.3
Built: Fri Jul 23 19:35:35 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.5.2-0ubuntu1~20.04.2
GitCommit:
runc:
Version: 1.0.0~rc95-0ubuntu1~20.04.2
GitCommit:
docker-init:
Version: 0.19.0
GitCommit:

这就是我构建图像并运行它的方式
sudo docker build -t test .
sudo docker run test --gpus all

最佳答案

此命令的顺序不正确:

sudo docker run test --gpus all
docker run 命令采用以下语法:
docker ${args_to_docker} run ${args_to_run} image_name ${cmd_override}
--gpusrun 的标志命令,而不是要在容器中运行的命令。因此,您将重新排序为:
sudo docker run --gpus all test

关于python - docker :来自守护进程的错误响应:未能创建垫片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68575716/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com