Premiers pas avec un conteneurs de deep learning local
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Cette page explique comment créer et configurer un conteneur de deep learning local.
Dans ce guide, nous partons du principe que vous maîtrisez les bases de Docker.
Avant de commencer
Pour configurer un compte Google Cloud , activer les API requises, puis installer et activer le logiciel requis, procédez comme suit :
Dans la console Google Cloud , accédez à la page Gérer les ressources, puis sélectionnez ou créez un projet.
Si vous utilisez un système d'exploitation Linux, tel qu'Ubuntu ou Debian, ajoutez votre nom d'utilisateur au groupe docker afin de pouvoir exécuter Docker sans utiliser sudo :
sudousermod-a-Gdocker${USER}
Une fois que vous vous serez ajouté au groupe docker, vous devrez peut-être redémarrer votre système.
Ouvrez Docker. Pour vérifier que Docker est en cours d'exécution, exécutez la commande Docker suivante, qui renvoie la date et l'heure actuelles :
docker run busybox date
Utilisez gcloud comme assistant d'identification pour Docker :
gcloud auth configure-docker
Facultatif : Si vous souhaitez exécuter le conteneur à l'aide d'un GPU en local, installez nvidia-docker.
Créer un conteneur
Suivez la procédure ci-dessous pour créer un conteneur.
Pour afficher la liste des conteneurs disponibles, procédez comme suit :
gcloud container images list \
--repository="gcr.io/deeplearning-platform-release"
Consultez la page Choisir un conteneur pour vous aider à sélectionner le conteneur de votre choix.
Si vous n'avez pas besoin d'utiliser un conteneur compatible GPU, saisissez l'exemple de code suivant. Remplacez tf-cpu.1-13 par le nom du conteneur que vous souhaitez utiliser.
docker run -d -p 8080:8080 -v /path/to/local/dir:/home/jupyter \
gcr.io/deeplearning-platform-release/tf-cpu.1-13
Si vous souhaitez utiliser un conteneur compatible GPU, saisissez l'exemple de code suivant. Remplacez tf-gpu.1-13 par le nom du conteneur que vous souhaitez utiliser.
docker run --runtime=nvidia -d -p 8080:8080 -v /path/to/local/dir:/home/jupyter \
gcr.io/deeplearning-platform-release/tf-gpu.1-13
Cette commande démarre le conteneur en mode dissocié, installe le répertoire local /path/to/local/dir dans /home/jupyter dans le conteneur, et mappe le port 8080 du conteneur au port 8080 de votre ordinateur local. Le conteneur est préconfiguré pour démarrer un serveur JupyterLab, accessible depuis http://localhost:8080.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (UTC)."],[[["\u003cp\u003eThis guide details the process of creating and setting up a local deep learning container, requiring basic Docker knowledge.\u003c/p\u003e\n"],["\u003cp\u003eThe setup involves creating or selecting a Google Cloud project, installing and initializing the gcloud CLI, and installing Docker, with specific instructions for Linux users to avoid using \u003ccode\u003esudo\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eUsers can choose from available deep learning containers using a command to list them or visit the "Choosing a container" page, then using a command to either use a cpu container, or a gpu-enabled container.\u003c/p\u003e\n"],["\u003cp\u003eThe container is launched in detached mode, mounting a local directory to the container and mapping a port, which then allows the user to use a preconfigured JupyterLab server.\u003c/p\u003e\n"],["\u003cp\u003eOptionally, for those requiring GPU acceleration, the guide suggests installing \u003ccode\u003envidia-docker\u003c/code\u003e, and using the appropriate container creation command.\u003c/p\u003e\n"]]],[],null,["# Get started with a local deep learning container\n\nThis page describes how to create and set up a local deep learning container.\nThis guide expects you to have basic familiarity\nwith [Docker](https://www.docker.com/).\n\nBefore you begin\n----------------\n\nComplete the following steps to set up a Google Cloud account, enable\nthe required APIs, and install and activate the required software.\n\n1. In the Google Cloud Console, go to the **Manage resources** page\n and select or create a project.\n\n | **Note:** If you don't plan to keep the resources you create in this tutorial, create a new project instead of selecting an existing project. After you finish, you can delete the project, removing all resources associated with the project and tutorial.\n\n [Go to Manage\n resources](https://console.cloud.google.com/cloud-resource-manager)\n2. [Install and initialize the\n gcloud CLI](/sdk/docs).\n\n3. [Install Docker](https://docs.docker.com/install/).\n\n If you're using a Linux-based operating system, such as Ubuntu or Debian,\n add your username to the `docker` group so that you can run Docker\n without using `sudo`: \n\n sudo usermod -a -G docker ${USER}\n\n | **Caution:** The `docker` group is equivalent to the `root` user. See [Docker's documentation](https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface) for details on how this affects the security of your system.\n\n You may need to restart your system after adding yourself to\n the `docker` group.\n4. Open Docker. To ensure that Docker is running, run the following\n Docker command, which returns the current time and date:\n\n docker run busybox date\n\n5. Use `gcloud` as the credential helper for Docker:\n\n gcloud auth configure-docker\n\n6. **Optional** : If you want to run the container using GPU locally,\n install\n [`nvidia-docker`](https://github.com/NVIDIA/nvidia-docker#quickstart).\n\nCreate your container\n---------------------\n\nFollow these steps to create your container.\n\n1. To view a list of containers available:\n\n gcloud container images list \\\n --repository=\"gcr.io/deeplearning-platform-release\"\n\n You may want to go to [Choosing a container](/deep-learning-containers/docs/choosing-container)\n to help you select the container that you want.\n2. If you don't need to use a GPU-enabled container, enter the following code\n example. Replace \u003cvar translate=\"no\"\u003etf-cpu.1-13\u003c/var\u003e with the name of the container\n that you want to use.\n\n docker run -d -p 8080:8080 -v /path/to/local/dir:/home/jupyter \\\n gcr.io/deeplearning-platform-release/\u003cvar translate=\"no\"\u003etf-cpu.1-13\u003c/var\u003e\n\n If you want to use a GPU-enabled container, enter the following code\n example. Replace \u003cvar translate=\"no\"\u003etf-gpu.1-13\u003c/var\u003e with the name of the container\n that you want to use. \n\n docker run --runtime=nvidia -d -p 8080:8080 -v /path/to/local/dir:/home/jupyter \\\n gcr.io/deeplearning-platform-release/\u003cvar translate=\"no\"\u003etf-gpu.1-13\u003c/var\u003e\n\nThis command starts up the container in detached mode, mounts the local\ndirectory `/path/to/local/dir` to `/home/jupyter` in the container, and maps\nport 8080 on the container to port 8080 on your local machine. The\ncontainer is preconfigured to start a JupyterLab server, which you can\nvisit at `http://localhost:8080`.\n\nWhat's next\n-----------\n\n- Learn more about how to work with containers in the [Docker\n documentation](https://docs.docker.com)."]]