| Server IP : 35.236.43.222 / Your IP : 216.73.216.143 Web Server : Apache System : Linux order-form-vm-001 5.10.0-37-cloud-amd64 #1 SMP Debian 5.10.247-1 (2025-12-11) x86_64 User : deploy ( 1002) PHP Version : 8.1.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /usr/lib/google-cloud-sdk/lib/surface/__pycache__/ |
Upload File : |
�
�� � �2 � d Z ddlmZ ddlmZ ddlmZ ddlZddlmZ ddlmZ ddlm Z dd l
mZ dd
lm
Z ddlmZ ddlmZ ej Zd
Z ej ej j � � ej de�� � G d� dej � � � � � � ZdS )z�Enable Docker CLI access to Google Container Registry.
Sets Docker up to authenticate with Container Registry,
and passes all flags after `--` to the Docker CLI.
� )�absolute_import)�division)�unicode_literalsN)�arg_parsers)�base)�
exceptions)�log)�
client_lib)� constants)�dockera `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
F)�
is_removed�warningc �@ � e Zd ZdZdej iZed� � � Zd� Z dS )�Dockera� Enable Docker CLI access to Google Container Registry.
{command} 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 `{command} -- --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/)
## EXAMPLES
To pull the image '{registry}/google-containers/pause:1.0' from the docker
registry, run:
```
{command} -- pull {registry}/google-containers/pause:1.0
```
Push the image '{registry}/example-org/example-image:latest' to our private
docker registry.
```
{command} -- push {registry}/example-org/example-image:latest
```
Configure authentication, then simply use docker:
```
{command} --authorize-only
docker push {registry}/example-org/example-image:latest
```
�registryc � � | � ddt j d�� � dddt �� � | � d d
dd�
� � | � dd�� � | � dt j g d�� � d S )Nz--serverz-s� )�
min_length�SERVERz%Address of the Google Cloud Registry.F)�type�metavar�help�required�defaultz--authorize-onlyz-azKConfigure Docker authorization only; do not launch the Docker command-line.�
store_true)r �actionz
--docker-hostzSURL to connect to Docker Daemon. Format: tcp://host:port or unix:///path/to/socket.)r �docker_argszArguments to pass to Docker.)�nargsr r )�add_argumentr �ArgList�_DEFAULT_REGISTRIES�argparse� REMAINDER)�parsers �lib/surface/docker.py�ArgszDocker.Argse s� � �
����D�
�
�A�
.�
.�
.��
4��#�
� %� %� %� ����D��� � � � � ����"� � #� #� #�
����X�/��
+� � -� -� -� -� -� c �l � |j rt j d� � t j � � 5 d}|j D ]K}|t vr(t j d� |�� � � � t j ||�� � d}�L|j
rFt j � d� |j �� � � � ddd� � dS |j
pg }|j s|nd |j g|z }t j |� � }|rt# j |�
� � � ddd� � dS # 1 swxY w Y dS )a Executes the given docker command, after refreshing our credentials.
Args:
args: An argparse.Namespace that contains the values for
the arguments specified in the .Args() method.
Raises:
exceptions.ExitCodeNoError: The docker command execution failed.
z�Docker uses the account from the gcloud config.To set the account in the gcloud config, run `gcloud config set account <account_name>`.Tz1Authenticating to a non-default server: {server}.)�server)�refreshFz+Short-lived access for {server} configured.Nz-H)� exit_code)�accountr r r �WithLegacyQuotar) r! �formatr �UpdateDockerCredentials�authorize_only�err�Printr �docker_host�docker_client_utils�Executer �ExitCodeNoError)�self�args�
force_refreshr) r �results r% �Runz
Docker.Run} s� � � �|� A�
�k� @� A� A� A�
� � � �
�
��m��K� � �&��,�,�,�
�+�A�H�H�� I� !� !�"� "� "� �&�v�}�E�E�E�E��
�
�
� � �
��
�
�C�J�J��;� K� � � !� !� !��%
�
�
�
�
�
�
�
�( �$�*��k�!�-� �+�+�D�$�:J�3K�
�4� � #�*�;�7�7�f�
� ;��(�6�:�:�:�:��=
�
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�
�
s �BD)�A
D)�)D-�0D-N)
�__name__�
__module__�__qualname__�__doc__r �DEFAULT_REGISTRY�
detailed_help�staticmethodr&