Pytorch and tensorflow in GPUs (Ubuntu amd64)
207
########################################################
# sudo docker build -t ddhmed/dl_gpu:20240531 .
# sudo docker run --gpus all -it --rm -v $PWD:/work -p 8000:8000 ddhmed/dl_gpu:20240531
########################################################
# 使用NVIDIA提供的CUDA基础镜像
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu20.04
### 作者和邮箱
MAINTAINER ddhmed [email protected]
USER root
# 设置时区,避免交互式提示
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# 安装基本工具和Python
RUN apt-get update && apt-get install -y \
build-essential \
cmake \
git \
curl \
wget \
ca-certificates \
libjpeg-dev \
libpng-dev \
python3 \
python3-dev \
python3-pip \
&& rm -rf /var/lib/apt/lists/*
# 创建一个符号链接,使 python3 命令可以用 python 调用
RUN ln -s /usr/bin/python3 /usr/bin/python
# 升级pip
RUN pip3 install --upgrade pip
# install base packages
RUN pip install --no-cache-dir \
numpy \
scipy \
statsmodels \
pandas \
plotly \
biopython \
networkx \
scikit-learn \
matplotlib \
jupyterlab
# 安装 PyTorch、TensorFlow、HuggingFace 和 LangChain
# Install PyTorch with CUDA 11.8 support
COPY torch-2.0.0+cu118-cp38-cp38-linux_x86_64.whl .
RUN pip install --no-cache-dir torch-2.0.0+cu118-cp38-cp38-linux_x86_64.whl
RUN pip install --no-cache-dir torch==2.0.0+cu118 torchvision==0.15.1+cu118 torchaudio==2.0.1+cu118 -f https://download.pytorch.org/whl/torch_stable.html
RUN pip install --no-cache-dir \
tensorflow \
bitsandbytes \
transformers \
safetensors \
huggingface_hub[cli]
#RUN pip install --no-cache-dir \
# langchain \
# wikipedia \
# tiktoken \
# neo4j \
# langchain_openai \
# langchain_community \
# langchainhub \
# openai \
# qianfan
# 清理不必要的文件
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
### 设置工作目录
WORKDIR /work
# 暴露 Jupyter Notebook 端口
EXPOSE 8000
CMD ["jupyter", "lab", "--allow-root", "--ip=0.0.0.0", "--port=8000"]
Content type
Image
Digest
sha256:cd07a27eb…
Size
7.4 GB
Last updated
6 months ago
docker pull ddhmed/dl_gpu:20240531