Bohrium Image Management — Bohrium 图像管理
v2通过bohr CLI或open.bohrium.com API管理Bohrium容器镜像。使用场景:用户询问关于列出、拉取、创建、删除Bohrium上的Docker镜像,或查找可用的公共镜像。非适用场景:节点管理、作业提交或项目管理。
运行时依赖
安装命令
点击复制技能文档
SKILL:Bohrium 镜像管理概述 在 Bohrium 平台上管理容器镜像。优先使用 bohr CLI;对于 Dockerfile 构建和版本搜索,回退到 API。自 2023 年起,Bohrium 不再支持 VM 作业 —— 需要容器镜像。 身份验证 "bohrium-image": { "enabled": true, "apiKey": "YOUR_ACCESS_KEY", "env": { "ACCESS_KEY": "YOUR_ACCESS_KEY" } } 前提条件: 安装 bohr CLI # macOS /bin/bash -c "$(curl -fsSL https://dp-public.oss-cn-beijing.aliyuncs.com/bohrctl/1.0.0/install_bohr_mac_curl.sh)" # Linux /bin/bash -c "$(curl -fsSL https://dp-public.oss-cn-beijing.aliyuncs.com/bohrctl/1.0.0/install_bohr_linux_curl.sh)" source ~/.bashrc && export PATH="$HOME/.bohrium:$PATH" 列出镜像 bohr image list # 自定义镜像(表格) bohr image list --json # JSON # 按类型列出公共镜像 bohr image list -t "Basic Image" bohr image list -t "DeePMD-kit" bohr image list -t "LAMMPS" bohr image list -t "ABACUS" bohr image list -t "CP2K" bohr image list -t "GROMACS" bohr image list -t "Uni-Mol" JSON 字段:imageId、name、url、status(可用/构建中)、creatorName 快速参考:公共镜像 基础镜像 场景 镜像 CPU registry.dp.tech/dptech/ubuntu:20.04-py3.10 CPU + Intel MPI registry.dp.tech/dptech/ubuntu:20.04-py3.10-intel2022 GPU registry.dp.tech/dptech/ubuntu:20.04-py3.10-cuda11.6 GPU + Intel MPI registry.dp.tech/dptech/ubuntu:20.04-py3.10-intel2022-cuda11.6 科学软件 软件 镜像 DeePMD-kit registry.dp.tech/dptech/deepmd-kit:2.1.5-cuda11.6 DPGEN registry.dp.tech/dptech/dpgen:0.10.6 LAMMPS registry.dp.tech/dptech/lammps:29Sep2021 GROMACS registry.dp.tech/dptech/gromacs:2022.2 Quantum-Espresso registry.dp.tech/dptech/quantum-espresso:7.1 CP2K registry.dp.tech/dptech/cp2k:7.1 ABACUS registry.dp.tech/dptech/abacus:3.0.0 预安装软件(所有公共镜像) 类别 软件 Python python3.10、pip、Anaconda、Jupyter Lab 文件工具 wget、curl、unzip、rsync、tree、git 编辑器 emacs、vim 构建工具 cmake、build-essential(GNU) 监控 htop、ncdu、net-tools DP 工具 Bohrium CLI、DP-Dispatcher、dpdata VM 到容器镜像映射 VM 镜像 容器镜像 LBG_DeePMD-kit_2.1.4_v1 registry.dp.tech/dptech/deepmd-kit:2.1.5-cuda11.6 LBG_DP-GEN_0.10.6_v3 registry.dp.tech/dptech/dpgen:0.10.6 LBG_LAMMPS_stable_23Jun2022_v1 registry.dp.tech/dptech/lammps:29Sep2021 gromacs-dp:2020.2 registry.dp.tech/dptech/gromacs:2022.2 LBG_Quantum-Espresso_7.1 registry.dp.tech/dptech/quantum-espresso:7.1 LBG_Common_v1/v2 registry.dp.tech/dptech/ubuntu:20.04-py3.10-cuda11.6 LBG_oneapi_2021_v1 registry.dp.tech/dptech/ubuntu:20.04-py3.10-intel2022-cuda11.6 拉取镜像到本地 bohr image pull registry.dp.tech/dptech/deepmd-kit:3.0.0b3-cuda12.1 需要在本地运行 Docker。仅支持公共镜像和自定义镜像。 手动 Docker 拉取(替代方法) 将域名替换为 registry.bohrium.dp.tech(不是 registry.dp.tech): docker login registry.bohrium.dp.tech docker pull registry.bohrium.dp.tech/dptech/ubuntu:22.04-py3.10-intel2022 # 推送不支持 删除自定义镜像 bohr image delete 121510 bohr image delete 121510 121395 # 批量镜像缓存 场景 详细信息 公共镜像 持久缓存;无额外拉取时间 新自定义镜像 缓存构建在 10-30 分钟内;等待后使用 未使用 30 天 缓存过期;下次使用时重新拉取 有缓存 CPU ~20s 启动,GPU ~40s 启动 无缓存 +10-30 分钟的镜像拉取时间 API 补充(CLI 不支持) 搜索公共镜像版本 import os, requests AK = os.environ.get("ACCESS_KEY", "") HEADERS = {"accessKey": AK} r = requests.get("https://open.bohrium.com/openapi/v2/image/public/version/search", headers=HEADERS, params={"keyword": "deepmd", "page": 1, "pageSize": 5}) # 返回:{items: [{version, resourceType, size, url, imageName}, ...]} 浏览公共镜像 r = requests.get("https://open.bohrium.com/openapi/v2/image/public", headers=HEADERS, params={"page": 1, "pageSize": 10}) r = requests.get(f"https://open.bohrium.com/openapi/v2/image/public/{image_id}/version", headers=HEADERS, params={"page": 1, "pageSize": 10}) 从 Dockerfile 构建 HEADERS_JSON = {**HEADERS, "Content-Type": "application/json"} # 注意:dockerfile 字段必须是 base64 编码 import base64 dockerfile_content = "FROM ubuntu:22.04\nRUN apt-get update && apt-get install -y python3" dockerfile_b64 = base64.b64encode(dockerfile_content.encode()).decode() r = requests.post("https://open.bohrium.com/openapi/v2/image/private", headers=HEADERS_JSON, json={ "name": "my-image", "projectId": 154, "device": "container", "desc": "Custom training image", "buildType": 1, "dockerfile": dockerfile_b64, }) # 验证 Dockerfile(也需要 base64) check_b64 = base64.b64encode(b"FROM ubuntu:22.04\nRUN apt-get update").decode() requests.post("https://open.bohrium.com/openapi/v2/image/dockerfile/check", headers=HEADERS_JSON, json={"dockerfile": check_b64}) 私有镜像管理 # 列出(更多)