更新时间:2025-07-29 GMT+08:00
分享

ECS中构建新镜像

通过ECS获取基础镜像获取基础镜像后,可通过ECS运行Dockerfile文件,在镜像的基础上构建新镜像。

Step1 构建新ModelArts Standard训练镜像

获取模型软件包,并上传到ECS的目录下(可自定义路径),获取地址参考表1

  1. 解压AscendCloud压缩包及该目录下的训练代码AscendCloud-AIGC-6.3.912-xxx.zip,并直接进入到QwenVL/train/<commit_id>文件夹下面
    unzip AscendCloud-*.zip -d ./AscendCloud && unzip ./AscendCloud/AscendCloud-AIGC-*.zip -d ./AscendCloud/AscendCloud-AIGC
    cd ./AscendCloud/AscendCloud-AIGC/multimodal_algorithm/QwenVL/train/<commit_id>
  1. 执行以下命令制作训练镜像。安装过程需要连接互联网git clone,请确保ECS可以访问公网
    docker build -t <镜像名称>:<版本名称>  .
    图1 docker镜像构建过程

    如果无法访问公网,则可以配置代理,增加`--build-arg`参数指定代理地址,可访问公网。

    docker build --build-arg "https_proxy=http://xxx.xxx.xxx.xxx" --build-arg "http_proxy=http://xxx.xxx.xxx.xxx" --network=host -t <镜像名称>:<版本名称>  .
    • <镜像名称>:<版本名称>:定义镜像名称。示例:pytorch_2_1_ascend:20240606
    • 记住使用Dockerfile创建的新镜像名称, 后续使用 ${dockerfile_image_name} 进行表示。

相关文档