gcloud docker - enable Docker CLI access to Google Container Registry
gcloud docker [--authorize-only, -a] [--docker-host=DOCKER_HOST] [--server=SERVER,[SERVER,...], -s SERVER,[SERVER,...]; default="gcr.io,us.gcr.io,eu.gcr.io,asia.gcr.io,staging-k8s.gcr.io,marketplace.gcr.io"] [GCLOUD_WIDE_FLAG ...] [-- DOCKER_ARGS ...]
(DEPRECATED) Enable Docker CLI access to Google Container Registry.
gcloud docker will not be supported for Docker client versions above 18.03.
As an alternative, use gcloud auth configure-docker to configure docker to use gcloud as a credential helper, then use docker as you would for non-GCR registries, e.g. docker pull gcr.io/project-id/my-image. Add --verbosity=error to silence this warning: gcloud docker --verbosity=error -- pull gcr.io/project-id/my-image.
See: https://cloud.google.com/container-registry/docs/support/deprecation-notices#gcloud-docker
gcloud docker wraps Docker commands so that gcloud can inject the appropriate fresh authentication token into requests that interact with the Docker registry.
All Docker-specific flags are passed through to the underlying docker command. A full reference of Docker's command line options available after -- can be found here: https://docs.docker.com/engine/reference/commandline/cli/. You may also run gcloud docker -- --help to view the Docker CLI's help directly.
Detailed documentation on Container Registry can be found here: https://cloud.google.com/container-registry/docs/
To pull the image 'gcr.io/google-containers/pause:1.0' from the docker registry, run:
gcloud docker -- pull gcr.io/google-containers/pause:1.0
Push the image 'gcr.io/example-org/example-image:latest' to our private docker registry.
gcloud docker -- push gcr.io/example-org/example-image:latest
Configure authentication, then simply use docker:
gcloud docker --authorize-only docker push gcr.io/example-org/example-image:latest
- [-- DOCKER_ARGS ...]
Arguments to pass to Docker.
The '--' argument must be specified between gcloud specific args on the left and DOCKER_ARGS on the right.
- --authorize-only, -a
Configure Docker authorization only; do not launch the Docker command-line.
- --docker-host=DOCKER_HOST
URL to connect to Docker Daemon. Format: tcp://host:port or unix:///path/to/socket.
- --server=SERVER,[SERVER,...], -s SERVER,[SERVER,...]; default="gcr.io,us.gcr.io,eu.gcr.io,asia.gcr.io,staging-k8s.gcr.io,marketplace.gcr.io"
Address of the Google Cloud Registry.
These flags are available to all commands: --access-token-file, --account, --billing-project, --configuration, --flags-file, --flatten, --format, --help, --impersonate-service-account, --log-http, --project, --quiet, --trace-token, --user-output-enabled, --verbosity.
Run $ gcloud help for details.