镜像构建总览
本页汇总 CubeStudio 平台涉及的各类镜像:它们在仓库中的目录位置、用途,以及在线构建与二次封装的常用做法。具体构建脚本与最新 tag 以源码 Dockerfile / build.sh 为准,本页仅供导航。
一、镜像分类与目录
基础组件镜像
对外部依赖的开源组件,主要直接从 docker hub 官网下载,不做二次封装。若依赖的开源组件存在二次封装的 Dockerfile,则放在对应开源组件目录下。
CubeStudio 平台镜像
| 镜像 | Dockerfile 位置 | 用途 |
|---|---|---|
| 基础环境镜像 | install/docker/Dockerfile-base |
平台后端的基础环境 |
| 后端镜像 | install/docker/Dockerfile |
后端,同时用于 watch、调度器、执行器组件 |
| 前端镜像 | install/docker/dockerFrontend/Dockerfile |
CubeStudio 前端 |
已核实上述三个文件均存在(
install/docker/Dockerfile-base、install/docker/Dockerfile、install/docker/dockerFrontend/Dockerfile)。
任务模板镜像
job-template/job/$job-name:每个任务模板目录下都包含自己的 Dockerfile。
notebook 镜像
| 类型 | 目录 | 说明 |
|---|---|---|
| jupyter | images/jupyter-notebook |
含普通版(Dockerfile-ubuntu-base)、conda 版(Dockerfile-ubuntu-conda)、大数据版(bigdata/)、pro 版(Dockerfile-ubuntu-cpu-pro.md)等 |
| theia (vscode) | images/theia-new |
theia / vscode 镜像(仓库另有旧目录 images/theia) |
| rstudio | images/rstudio |
rstudio 镜像 |
| matlab | images/matlab |
matlab 镜像 |
GPU 开发镜像
images/ubuntu-gpu:包含多个 python 版本、多个 cuda 版本的 GPU 开发环境镜像。tag 清单见下文「四、GPU 基础镜像 tag 清单」。
NNI 开发镜像
images/nni:nni 的开发环境镜像,用户需在此镜像基础上进行二次封装。
推理服务镜像
images/serving:包含 ml(ml-server)、tfserving、torchserver、triton-server 等推理框架镜像;另有 llm-safe-stream、mindie 等。这些镜像主要为外部开源镜像,平台在其上增加一些运维组件。
已按代码修正:源目录为
images/serving(非images/service),其下推理框架子目录为ml、tfserving、torchserver、triton-server(另含llm-safe-stream、mindie)。
aihub 镜像
aihub/src/docker:aihub 相关的基础镜像(如 Dockerfile-base、Dockerfile-cuda11.8-python、各 modelscope 版本镜像等)。
二、在线构建镜像
平台支持在线构建镜像(在「镜像」/「在线构建」入口中提供基础镜像、目标镜像、Dockerfile 等,平台代为构建并推送)。下文为二次封装时常用的 Dockerfile 片段示例(来自 images/README.md,为示例,版本号以实际镜像为准)。
修改默认 python 版本
rm /usr/bin/python
ln -s /usr/bin/python3.6 /usr/bin/python
rm /usr/bin/pip
ln -s /usr/bin/pip3 /usr/bin/pip
pip install pip --upgrade
ubuntu 容器基础工具的封装
RUN apt update
# 安装运维工具
RUN apt install -y --force-yes --no-install-recommends \
vim apt-transport-https gnupg2 ca-certificates-java rsync jq \
wget git dnsutils iputils-ping net-tools curl mysql-client locales zip
# 安装 python
RUN apt install -y python3.6-dev python3-pip libsasl2-dev libpq-dev \
&& ln -s /usr/bin/python3 /usr/bin/python \
&& ln -s /usr/bin/pip3 /usr/bin/pip
# 安装中文
RUN apt install -y --force-yes --no-install-recommends \
locales ttf-wqy-microhei ttf-wqy-zenhei xfonts-wqy \
&& locale-gen zh_CN && locale-gen zh_CN.utf8
ENV LANG=zh_CN.UTF-8
ENV LC_ALL=zh_CN.UTF-8
ENV LANGUAGE=zh_CN.UTF-8
# 便捷操作
RUN echo "alias ll='ls -alF'" >> ~/.bashrc && \
echo "alias la='ls -A'" >> ~/.bashrc && \
echo "alias vi='vim'" >> ~/.bashrc
# 安装其他工具
### kubectl(示例版本,按需调整)
RUN curl -LO https://dl.k8s.io/release/v1.16.0/bin/linux/amd64/kubectl \
&& chmod +x kubectl && mv kubectl /usr/local/bin/
### mysql 客户端
RUN apt install -y mysql-client-5.7
### java
RUN apt install -y openjdk-8-jdk
### nodejs
RUN curl -sL https://deb.nodesource.com/setup_13.x | bash -
RUN apt-get install -y nodejs && npm config set unicode false
三、GPU 基础镜像构建脚本
构建脚本:images/ubuntu-gpu/build.sh(GitHub 外链:https://github.com/data-infra/cube-studio/blob/main/images/ubuntu-gpu/build.sh)。
构建方式(来自 build.sh,已核实):以 nvidia/cuda:<ver>-cudnn8-devel-ubuntu20.04 为基础镜像,先构建 ubuntu-gpu:cuda<ver>-cudnn8-<arch>,再叠加 python 版本构建 ...-python3.x-<arch>,推送到 ccr.ccs.tencentyun.com/cube-studio。
TARGETARCH=amd64
hubhost=ccr.ccs.tencentyun.com/cube-studio
base_image=nvidia/cuda:11.8.0-cudnn8-devel-ubuntu20.04
docker build --network=host -t $hubhost/ubuntu-gpu:cuda11.8.0-cudnn8-$TARGETARCH \
--build-arg FROM_IMAGES=$base_image -f cuda/Dockerfile .
docker build --network=host -t $hubhost/ubuntu-gpu:cuda11.8.0-cudnn8-python3.9-$TARGETARCH \
--build-arg FROM_IMAGES=$hubhost/ubuntu-gpu:cuda11.8.0-cudnn8-$TARGETARCH \
--build-arg PYTHON_VERSION=python3.9 -f cuda/python/Dockerfile .
注意:当前
images/ubuntu-gpu/build.sh仅构建cuda11.8.0-cudnn8与cuda12.1.0-cudnn8(均基于 ubuntu20.04,含 python3.9 变体)两组。下文「四」中 cuda9.0 ~ cuda12.1 的完整 tag 清单来自images/README.md,属历史/全量清单,部分老 tag 可能未在当前 build.sh 中维护,请以镜像仓库实际可拉取的 tag 为准。
四、GPU 基础镜像 tag 清单
镜像前缀统一为 ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:,下表省略前缀只列 tag。来源 images/README.md。
ubuntu
| cuda/cudnn | 基础 tag | python 变体 |
|---|---|---|
| cuda12.1.0-cudnn8 | cuda12.1.0-cudnn8-amd64 |
-python3.11-amd64, -python3.10-amd64, -python3.9-amd64 |
| cuda11.8.0-cudnn8 | cuda11.8.0-cudnn8-amd64 |
-python3.11-amd64, -python3.10-amd64, -python3.9, -python3.8, -python3.7 |
| cuda11.0.3-cudnn8 | cuda11.0.3-cudnn8 |
-python3.8, -python3.7 |
| cuda10.2-cudnn7 | cuda10.2-cudnn7 |
-python3.8, -python3.7 |
| cuda10.1-cudnn7 | cuda10.1-cudnn7 |
-python3.8, -python3.7, -python3.6 |
| cuda10.0-cudnn7 | cuda10.0-cudnn7 |
-python3.8, -python3.7, -python3.6 |
| cuda9.1-cudnn7 | cuda9.1-cudnn7 |
-python3.8, -python3.7, -python3.6 |
| cuda9.0-cudnn7 | cuda9.0-cudnn7 |
-python3.8, -python3.7, -python3.6 |
注:上表的 python 变体 tag 拼接规则在不同 cuda 版本间不完全一致——cuda12.1.0 / cuda11.8.0 的新 tag 带
-amd64架构后缀,老版本(cuda11.0.3 及以下)不带。请以镜像仓库实际 tag 为准。
以上目录与 tag 清单仅供导航,具体构建以仓库内 Dockerfile / build.sh 源码为准。