首先,使用其中一种可用的映像类型来创建 Deep Learning Containers 容器。然后使用 conda、pip 或 Jupyter 命令来根据需要修改容器映像。
构建并推送容器映像。
构建容器映像,然后将其推送到 Compute Engine 服务账号可访问的位置。
创建初始 Dockerfile 并运行修改命令
使用以下命令选择 Deep Learning Containers 映像类型,并对容器映像进行细微更改。此示例展示了如何从 TensorFlow 映像开始,并使用最新版本的 TensorFlow 更新映像。将以下命令写入 Dockerfile:
FROM us-docker.pkg.dev/deeplearning-platform-release/gcr.io/tf-gpu:latest
# Uninstall the container's TensorFlow version and install the latest version
RUN pip install --upgrade pip && \
pip uninstall -y tensorflow && \
pip install tensorflow
构建并推送容器映像
使用以下命令构建容器映像并将其推送到 Artifact Registry,您的 Google Compute Engine 服务账号可以在其中访问该映像。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-03-26。"],[[["This guide details the process of creating a derivative container from a standard Deep Learning Containers image, using either Cloud Shell or an environment with the Google Cloud CLI installed."],["The process involves creating an initial Dockerfile and executing modification commands, such as using conda, pip, or Jupyter commands, to customize the container image."],["Before starting, ensure you have completed the necessary setup steps, including enabling billing for your Google Cloud project and the Artifact Registry API."],["After modifying the container, you need to build it and push the resulting image to a repository, such as Artifact Registry, that is accessible to your Compute Engine service account."],["The example provided shows how to take a tensorflow image, and modify the container by uninstalling the current version and installing the latest version of Tensorflow."]]],[]]