Container Registry est obsolète. Container Registry est arrêté depuis le 18 mars 2025 et l'écriture d'images dans Container Registry n'est plus disponible. Pour en savoir plus sur l'abandon de Container Registry et sur la migration vers Artifact Registry, consultez la page Abandon de Container Registry.
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Container Registry met en cache les images Docker Hub publiques les plus demandées sur mirror.gcr.io. Vous pouvez configurer le daemon Docker pour utiliser une image publique mise en cache si elle est disponible, ou extraire l'image de Docker Hub si une copie mise en cache n'est pas disponible.
Google Cloud services tels que Cloud Build et Google Kubernetes Engine recherchent automatiquement des images mises en cache avant d'essayer d'extraire une image de Docker Hub.
Les images mises en cache sur mirror.gcr.io sont :
stockées dans un dépôt géré par Google ;
davantage isolées en cas de pannes de Docker Hub ;
faciles à intégrer à l' Google Cloud écosystème ;
synchronisées avec Docker Hub.
Configurer le daemon Docker
Pour configurer votre daemon Docker afin d'extraire des images du cache Container Registry, procédez comme suit :
CLI
Configurez le daemon de l'une des manières suivantes :
Pour configurer automatiquement le daemon Docker au démarrage, définissez la valeur suivante dans /etc/docker/daemon.json :
{"registry-mirrors":["https://mirror.gcr.io"]}
Lorsque vous démarrez le daemon, transmettez le nom d'hôte Container Registry :
dockerd--registry-mirror=https://mirror.gcr.io
Ajoutez la ligne suivante à votre fichier /etc/default/docker :
Container Registry ajoute au cache les images qui font l'objet de requêtes fréquentes, de sorte qu'elles soient disponibles pour les requêtes ultérieures. Il supprime également régulièrement les images qui ne sont plus demandées.
Une fois que vous avez configuré le daemon Docker pour utiliser le cache Container Registry, Docker effectue les opérations suivantes lorsque vous extrayez une image Docker Hub publique à l'aide d'une commande docker pull :
Le daemon Docker vérifie le cache Container Registry et récupère les images, si elles existent. Si la configuration de votre daemon inclut d'autres miroirs Docker, le daemon vérifie chacun d'entre eux afin d'obtenir une copie mise en cache de l'image.
S'il ne trouve toujours pas l'image, le daemon Docker la récupère depuis le dépôt canonique sur Docker Hub.
L'extraction d'images mises en cache n'est pas comptabilisée dans les limites de débit de Docker Hub. Cependant, rien ne garantit qu'une image donnée restera en cache pendant une période prolongée. Vous pouvez obtenir uniquement les images mises en cache sur mirror.gcr.io en configurant le daemon Docker. Une requête pour extraction directe de mirror.gcr.io échoue si aucune copie mise en cache de l'image n'existe.
Étape suivante
Vous pouvez créer vos propres miroirs Docker locaux pour mettre en cache des images. Pour en savoir plus, consultez la documentation Docker.
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/03 (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/03 (UTC)."],[[["\u003cp\u003eContainer Registry caches frequently-accessed public Docker Hub images on \u003ccode\u003emirror.gcr.io\u003c/code\u003e, improving image pull performance and reliability.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Cloud services automatically check for cached images before pulling from Docker Hub, streamlining workflows within the Google Cloud ecosystem.\u003c/p\u003e\n"],["\u003cp\u003eConfiguring the Docker daemon to use \u003ccode\u003emirror.gcr.io\u003c/code\u003e allows it to prioritize pulling images from the cache, falling back to Docker Hub if the image is not found there.\u003c/p\u003e\n"],["\u003cp\u003ePulling images from the Container Registry cache does not count against Docker Hub rate limits, offering a workaround to potential restrictions on the Docker Free plan.\u003c/p\u003e\n"],["\u003cp\u003eCached images are stored in a Google-managed repository, are kept in sync with Docker Hub, and offer greater insulation from Docker Hub outages.\u003c/p\u003e\n"]]],[],null,["# Pulling cached Docker Hub images\n\nContainer Registry caches frequently-accessed public Docker Hub images on\n`mirror.gcr.io`. You can configure the Docker daemon to use a cached public\nimage if one is available, or pull the image from Docker Hub if a cached copy\nis unavailable.\n\nGoogle Cloud services such as Cloud Build and Google Kubernetes Engine automatically\ncheck for cached images before attempting to pull an image from Docker Hub.\n| **Note:** As of November 1, 2020, Docker Hub\n| [rate limits](https://www.docker.com/blog/scaling-docker-to-serve-millions-more-developers-network-egress/) apply to unauthenticated or authenticated pull requests on the\n| Docker Free plan. To avoid disruptions and have greater control over your\n| software supply chain, you can migrate your dependencies to [Artifact Registry](/artifact-registry/docs/docker/migrate-external-containers).\n\nCached images at `mirror.gcr.io` are:\n\n- Stored in a repository that Google manages.\n- More insulated from Docker Hub outages.\n- Easily integrated with the Google Cloud ecosystem.\n- Kept in sync with Docker Hub.\n\nConfiguring the Docker daemon\n-----------------------------\n\nTo configure your Docker daemon to pull images from the Container Registry\ncache: \n\n### CLI\n\n1. Configure the daemon in one of the following ways:\n\n - To configure the Docker daemon automatically on startup, set\n the following value in `/etc/docker/daemon.json`\n\n {\n \"registry-mirrors\": [\"https://mirror.gcr.io\"]\n }\n\n - When you start the daemon, pass in the Container Registry\n hostname:\n\n dockerd --registry-mirror=https://mirror.gcr.io\n\n - Add the following line to your `/etc/default/docker` file:\n\n DOCKER_OPTS=\"${DOCKER_OPTS} --registry-mirror=https://mirror.gcr.io\"\n\n2. Restart the Docker daemon.\n\n - On Linux, run one of the following commands:\n\n sudo service docker restart\n\n or \n\n sudo service docker stop && sudo service docker start\n\n - On macOS or Windows, run the following command:\n\n docker-machine restart\n\n### Docker UI\n\n1. Open Docker's **Preferences** menu.\n2. Click **Daemon**.\n3. Click **Advanced** . In the JSON field, add a `registry-mirrors` key with\n `https://mirror.gcr.io` as a value:\n\n {\n \"registry-mirrors\" : [\n \"https://mirror.gcr.io\"\n ]\n }\n\n4. Click **Apply \\& Restart**.\n\nTo verify that the cache is correctly configured, run: \n\n docker system info\n\nThe output should include `Registry Mirrors`, and should look similar to\nthe following: \n\n Containers: 2\n Running: 0\n Paused: 0\n Stopped: 2\n Images: 2\n Server Version: 17.03.1-ce\n Storage Driver: overlay2\n Backing Filesystem: extfs\n Supports d_type: true\n Native Overlay Diff: true\n Logging Driver: json-file\n ...\n Registry Mirrors:\n https://mirror.gcr.io\n\nPulling cached images\n---------------------\n\nContainer Registry adds frequently requested images to the cache\nso they are available for future requests. It also periodically removes images\nthat are no longer requested.\n\nAfter you configure the Docker daemon to use the Container Registry cache,\nDocker performs the following steps when you pull a public Docker Hub image\nwith a `docker pull` command:\n\n1. The Docker daemon checks the Container Registry cache and fetches the images if it exists. If your daemon configuration includes other Docker mirrors, the daemon checks each one in order for a cached copy of the image.\n2. If the image still isn't found, the Docker daemon fetches the image from the canonical repository on Docker Hub.\n\nPulling cached images does not count against Docker Hub rate limits. However,\nthere is no guarantee that a particular image will remain cached for an extended\nperiod of time. Only obtain cached images on `mirror.gcr.io` by\n[configuring the Docker daemon](#configure). A request to pull directly from\n`mirror.gcr.io` will fail if a cached copy of the image does not exist.\n\nWhat's next\n-----------\n\n- You can create your own local Docker mirrors to cache images. For details, see the [Docker documentation](https://docs.docker.com/registry/recipes/mirror/).\n- Read the [Docker Hub documentation](https://docs.docker.com/docker-hub/)."]]