CUDA 到 docker 容器

问题描述 投票:0回答:1

我需要为我的服务器创建 docker,但它只能与 cuda 一起使用,我如何将它添加到我的 Dockerfile 中?

FROM python:3.10

ENV FLASK_RUN_PORT=5000

RUN sudo nvidia-ctk runtime configure # Here

COPY . /app

WORKDIR /app

RUN pip install --no-cache-dir -r requirements.txt

EXPOSE 5000

CMD ["python", "server.py"]

我尝试这样做,但它不起作用,请帮忙

python docker deployment dockerfile
1个回答
5
投票

您可以从 CUDA Docker 映像开始,然后安装 Python,例如:

FROM nvidia/cuda:12.1.1-runtime-ubuntu20.04 

# Install Python
RUN apt-get update && \
    apt-get install -y python3-pip python3-dev && \
    rm -rf /var/lib/apt/lists/*

# Fix the broken symlink to the default Python
RUN apt update && apt install python-is-python3
© www.soinside.com 2019 - 2024. All rights reserved.