Extraer imágenes de Docker Hub almacenadas en caché
Organízate con las colecciones
Guarda y clasifica el contenido según tus preferencias.
Artifact Registry almacena en caché las imágenes públicas de Docker Hub a las que se accede con frecuencia en mirror.gcr.io. Puedes configurar el daemon de Docker para que use una imagen pública almacenada en caché si hay alguna disponible o para que extraiga la imagen de Docker Hub si no hay ninguna copia almacenada en caché.
Google Cloud servicios como Cloud Build y Google Kubernetes Engine comprueban automáticamente si hay imágenes almacenadas en caché antes de intentar extraer una imagen de Docker Hub.
Los servicios de
Las imágenes almacenadas en caché a las mirror.gcr.io son:
Se almacena en un repositorio gestionado por Google Cloud.
Mayor aislamiento frente a las interrupciones de Docker Hub.
Integrado con el ecosistema de Google Cloud .
Se mantiene sincronizado con Docker Hub.
Configurar el daemon de Docker
Para configurar tu daemon de Docker de forma que extraiga imágenes de la caché de Artifact Registry, sigue estos pasos:
CLI
Configure el daemon de una de las siguientes formas:
Para configurar el daemon de Docker automáticamente al inicio, define el siguiente valor en /etc/docker/daemon.json:
{"registry-mirrors":["https://mirror.gcr.io"]}
Cuando inicies el daemon, introduce el nombre de host de Artifact Registry:
dockerd--registry-mirror=https://mirror.gcr.io
Añade la siguiente línea a tu archivo /etc/default/docker:
Artifact Registry añade las imágenes solicitadas con frecuencia a la caché
para que estén disponibles en futuras solicitudes. También elimina periódicamente las imágenes que ya no se solicitan.
Después de configurar el daemon de Docker para que use la caché de Artifact Registry, Docker sigue estos pasos cuando extraes una imagen pública de Docker Hub con un comando docker pull:
El daemon de Docker comprueba la caché de Artifact Registry y obtiene las imágenes si existen. Si la configuración de tu daemon incluye otros espejos de Docker, el daemon comprueba cada uno de ellos en orden para buscar una copia en caché de la imagen.
Si la imagen sigue sin encontrarse, el daemon de Docker la obtiene del repositorio canónico de Docker Hub.
Extraer imágenes almacenadas en caché no se tiene en cuenta en los límites de frecuencia de Docker Hub. Sin embargo, no se garantiza que una imagen concreta permanezca en la caché durante un periodo prolongado. Solo se obtienen imágenes almacenadas en caché en mirror.gcr.io si configuras el daemon de Docker.
Para autenticarte en Docker Hub en el caso de las imágenes que no están almacenadas en caché en mirror.gcr.io, usa los repositorios remotos de Artifact Registry. Los repositorios remotos admiten la autenticación en Docker Hub. Te recomendamos que te autentiques en Docker Hub aunque solo uses imágenes públicas, ya que así aumentarás el límite de velocidad de descarga. Para obtener más información sobre los límites de velocidad de descarga de Docker Hub, consulta Límite de velocidad de Docker Hub.
Siguientes pasos
Puedes crear repositorios remotos de Artifact Registry para almacenar en caché imágenes de Docker Hub.
Puedes crear tus propios espejos de Docker locales para almacenar imágenes en caché. Para obtener más información, consulta la documentación de Docker.
[[["Es fácil de entender","easyToUnderstand","thumb-up"],["Me ofreció una solución al problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Es difícil de entender","hardToUnderstand","thumb-down"],["La información o el código de muestra no son correctos","incorrectInformationOrSampleCode","thumb-down"],["Me faltan las muestras o la información que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-08-20 (UTC)."],[[["\u003cp\u003eArtifact Registry caches frequently accessed public Docker Hub images on \u003ccode\u003emirror.gcr.io\u003c/code\u003e, allowing for faster access and increased insulation from Docker Hub outages.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Cloud services automatically prioritize checking for cached images on \u003ccode\u003emirror.gcr.io\u003c/code\u003e before pulling from Docker Hub.\u003c/p\u003e\n"],["\u003cp\u003eYou can configure your Docker daemon to utilize the Artifact Registry cache by modifying the \u003ccode\u003e/etc/docker/daemon.json\u003c/code\u003e file, using the \u003ccode\u003edockerd\u003c/code\u003e command, modifying \u003ccode\u003e/etc/default/docker\u003c/code\u003e, or using the Docker UI.\u003c/p\u003e\n"],["\u003cp\u003eWhen pulling a public Docker Hub image after configuring the cache, the Docker daemon will first check the \u003ccode\u003emirror.gcr.io\u003c/code\u003e cache, then any other configured mirrors, and lastly, Docker Hub itself.\u003c/p\u003e\n"],["\u003cp\u003ePulling images from the Artifact Registry cache on \u003ccode\u003emirror.gcr.io\u003c/code\u003e does not count against Docker Hub rate limits, and you can use remote repositories for images not in the cache.\u003c/p\u003e\n"]]],[],null,["# Pull cached Docker Hub images\n\nArtifact 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.\nGoogle Cloud services such as Cloud Build and Google Kubernetes Engine automatically check for cached images before attempting to pull an image from Docker Hub.\n\nCached images at `mirror.gcr.io` are:\n\n- Stored in a repository managed by Google Cloud.\n- More insulated from Docker Hub outages.\n- 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 Artifact 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 Artifact 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\nArtifact 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 Artifact 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 Artifact 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).\n\nTo authenticate to Docker Hub for images that aren't cached on `mirror.gcr.io`,\nuse Artifact Registry [remote repositories](/artifact-registry/docs/repositories/remote-overview). Remote\nrepositories support authentication to Docker Hub. We recommend authenticating\nto Docker Hub even if you are only using public images, as it will increase your\ndownload rate limit. For more information on Docker Hub download rate limits,\nsee [Docker Hub rate limit](https://docs.docker.com/docker-hub/download-rate-limit/).\n\nWhat's next\n-----------\n\n- You can create Artifact Registry [remote repositories](/artifact-registry/docs/repositories/remote-overview) to cache Docker Hub images.\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/)."]]