是这样的,我在用centos:7创建基础镜像并配置好环境以后,发现在容器中 没有nvidia-smi命令
这样:创建一个Dockerfile文件,添加如下,基础镜像根据自己的改一下
FROM segment_anything_env:202307171558 LABEL maintainer "chentiao_create" RUN echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && \ echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf ENV PATH /usr/local/nvidia/bin:/usr/local/cuda/bin:${PATH} ENV LD_LIBRARY_PATH /usr/local/nvidia/lib:/usr/local/nvidia/lib64 # nvidia-container-runtime ENV NVIDIA_VISIBLE_DEVICES all ENV NVIDIA_DRIVER_CAPABILITIES compute,utility ENV NVIDIA_REQUIRE_CUDA "cuda>=10.0"
然后再执行
docker build -t segment_anything_env:202307171633 .
就创建了segment_anything_env:202307171633镜像了,然后根据这个镜像创建容器就可以看到显卡了
标签:conf,centos7,usr,ENV,nvidia,镜像,local From: https://www.cnblogs.com/chentiao/p/17560680.html