Skip to content

镜像在线构建和管理

栾鹏 edited this page Sep 24, 2024 · 2 revisions

在线构建镜像

在云原生里面,所有的调度都是基于容器的。但是这一部分的门槛就比较高

1、算法工程师并不熟悉docker技术,另外部分环境在转化为dockerfile中浪费了很多时间,并且可能在编写dockerfile时比较难,比如在一个镜像中安装多个cuda的场景。

2、基础镜像封装太多,用户也不知道该选择什么镜像。

在这里插入图片描述 针对用户不熟悉docker技术的情况,cube加入了在线构建镜像的功能,启动调试直接进入bash命令行,像在linux上随意运行命令安装环境,之后点击保存后就会自动生成用户的工作镜像,并push到仓库。期间cube会自动寻找用户进行镜像调试的pod,在同一台机器上将用户的容器 commit成镜像,并将构建成的镜像进行推送到仓库。

对于有很多基础镜像的问题,cube采用的方案是仅封装cuba/python这类基础环境,对于再上层的环境,在任务运行时现场安装。也就是在基本的模板中都保留了能够让用户自定义初始化环境的命令的功能。毕竟对于长期运行的任务,安装环境的时间成本并不高。

在这里插入图片描述

平台支持用户通过web shell形式在线构建镜像,安装环境后保存镜像到自己的仓库中,方便用户快速构建和部署镜像。

web shell构建镜像

“在线开发”-“镜像构建”-docker“调试”,可以进入web shell界面,进行交互式镜像构建。

输入图片说明

进入web shell后,直接通过pip命令就能安装镜像中所需要的环境,不需要编写dockerfile来构建镜像了。

输入图片说明

dockerfile构建镜像

在“镜像管理”中添加镜像,其中可以添加dockerfile,添加dockerfile之后,“构建”列会出现“在线构建”。

输入图片说明

点击“在线构建”,即可进入在线构建的界面,如下图所示。

输入图片说明

修改默认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 -y

# 安装运维工具
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 traceroute

# 安装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基础镜像

构建脚本

ubuntu

cuda12.1.0-cudnn8

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda12.1.0-cudnn8-amd64

python3.11

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda12.1.0-cudnn8-python3.11-amd64

python3.10

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda12.1.0-cudnn8-python3.10-amd64

python3.9

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda12.1.0-cudnn8-python3.9-amd64

cuda11.8.0-cudnn8

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda11.8.0-cudnn8-amd64

python3.11

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda11.8.0-cudnn8-python3.11-amd64

python3.10

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda11.8.0-cudnn8-python3.10-amd64

python3.9

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda11.8.0-cudnn8-python3.9

python3.8

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda11.8.0-cudnn8-python3.8

python3.7

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda11.8.0-cudnn8-python3.7

cuda11.0.3-cudnn8

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda11.0.3-cudnn8

python3.8

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda11.0.3-cudnn8-python3.8

python3.7

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda11.0.3-cudnn8-python3.7

cuda10.2-cudnn7

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda10.2-cudnn7

python3.8

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda10.2-cudnn7-python3.8

python3.7

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda10.2-cudnn7-python3.7

cuda10.1-cudnn7

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda10.1-cudnn7

python3.8

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda10.1-cudnn7-python3.8

python3.7

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda10.1-cudnn7-python3.7

python3.6

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda10.1-cudnn7-python3.6

cuda10.0-cudnn7

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda10.0-cudnn7

python3.8

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda10.0-cudnn7-python3.8

python3.7

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda10.0-cudnn7-python3.7

python3.6

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda10.0-cudnn7-python3.6

cuda9.1-cudnn7

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda9.1-cudnn7

python3.8

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda9.1-cudnn7-python3.8

python3.7

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda9.1-cudnn7-python3.7

python3.6

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda9.1-cudnn7-python3.6

cuda9.0-cudnn7

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda9.0-cudnn7

python3.8

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda9.0-cudnn7-python3.8

python3.7

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda9.0-cudnn7-python3.7

python3.6

  • ccr.ccs.tencentyun.com/cube-studio/ubuntu-gpu:cuda9.0-cudnn7-python3.6

cuda10.1-cuda10.0-cuda9.0-cudnn7.6

  • ccr.ccs.tencentyun.com/cube-studio/gpu:ubuntu18.04-python3.6-cuda10.1-cuda10.0-cuda9.0-cudnn7.6-base

开源体验地址:

http://39.96.177.55:8888/

个人代理商咨询

代理商协议联系管理员

开源共建

学习、部署、体验、开源建设、商业合作 欢迎来撩

Clone this wiki locally