Cuda 11/10的Dockerfile

说明:如果NVIDIA显卡不满足要求,请修改dockerfile文件配置要求或慎重使用,关于dockerfile使用请参考我的博客文章:
https://blog.csdn.net/weixin_41194129/category_10210023.html
在这里插入图片描述

cuda11相关链接如下:
https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/
https://github.com/triton-inference-server/server/releases/tag/v2.7.0
https://github.com/Algorithm-learning-community-for-python/project_dockerfile/tree/master/cuda11

https://github.com/EnzoDAndrea/Container-TF2.4-CUDA-11

CUDA10.1-ubuntu16.04:

安装Docker 参考ubuntu安装docker
安装NVIDIA Container Toolkit 参考NVIDIA/nvidia-docker
准备好Python-3.6.9.tar.xz
从nvidia/cuda:10.0-cudnn7-devel-ubuntu16.04 镜像基础上搭建
安装openssh-server、python、pytorch
run镜像时加上参数--gpus all --ipc=host
# BASE IMAGE
FROM nvidia/cuda:10.0-cudnn7-devel-ubuntu16.04 

# LABEL MAINTAINER
LABEL xxx="xxx@xxx"

SHELL ["/bin/bash","-c"]

WORKDIR /tmp
# copy安装文件
COPY Python-3.6.9.tar.xz /tmp
# 设置 root 密码
RUN echo 'root:password' | chpasswd \
# 安装openssh-server 并配置
  && apt-get update && apt-get -y install openssh-server \
  && sed -i 's/UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config \ 
  && sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config \
  && mkdir /var/run/sshd \
# 安装python依赖包
  && apt-get -y install build-essential python-dev python-setuptools python-pip python-smbus \
  && apt-get -y install build-essential libncursesw5-dev libgdbm-dev libc6-dev \
  && apt-get -y install zlib1g-dev libsqlite3-dev tk-dev \
  && apt-get -y install libssl-dev openssl \
  && apt-get -y install libffi-dev \
# 安装python 3.6.9
  && mkdir -p /usr/local/python3.6 \
  && tar xvf Python-3.6.9.tar.xz \
  && cd Python-3.6.9 \
  && ./configure --prefix=/usr/local/python3.6 \
  && make altinstall \
# 建立软链接
  && ln -snf /usr/local/python3.6/bin/python3.6 /usr/bin/python3 \
  && ln -snf /usr/local/python3.6/bin/pip3.6 /usr/bin/pip3\
# 安装pytorch
  && mkdir ~/.pip && echo -e '[global] \nindex-url = https://mirrors.aliyun.com/pypi/simple/' >> ~/.pip/pip.conf \
  && pip3 install torch===1.2.0 torchvision===0.4.0 -f https://download.pytorch.org/whl/torch_stable.html \
# 清理copy的安装文件
  && apt-get clean \
  && rm -rf /tmp/* /var/tmp/*

EXPOSE 22

CMD ["/usr/sbin/sshd", "-D"]

构建镜像命令:
docker build -t dockerfile .

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

源代码杀手

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值