.. role:: raw-html-m2r(raw)
:format: html
Azure Container Registry client library for Python
==================================================
Azure Container Registry allows you to store and manage container images and artifacts in a private registry for all types of container deployments.
Use the client library for Azure Container Registry to:
* List images or artifacts in a registry
* Obtain metadata for images and artifacts, repositories and tags
* Set read/write/delete properties on registry items
* Delete images and artifacts, repositories and tags
`Source code `_ | [Package (Pypi)]\ :raw-html-m2r:`` | [API reference documentation]\ :raw-html-m2r:`` | `REST API documentation `_ | `Product documentation `_
Getting started
---------------
Install the package
^^^^^^^^^^^^^^^^^^^
Install the Azure Container Registry client library for Python with `pip `_\ :
.. code-block:: bash
pip install --pre azure-containerregistry
Prerequisites
^^^^^^^^^^^^^
You need an `Azure subscription `_ and a `Container Registry account `_ to use this package.
To create a new Container Registry, you can use the `Azure Portal `_\ ,
`Azure PowerShell `_\ , or the `Azure CLI `_.
Here's an example using the Azure CLI:
.. code-block:: Powershell
az acr create --name MyContainerRegistry --resource-group MyResourceGroup --location westus --sku Basic
Authenticate the client
^^^^^^^^^^^^^^^^^^^^^^^
The `Azure Identity library `_ provides easy Azure Active Directory support for authentication.
.. code-block:: python
# Create a ContainerRegistryClient that will authenticate through Active Directory
from azure.containerregistry import ContainerRegistryClient
from azure.identity import DefaultAzureCredential
account_url = "https://MYCONTAINERREGISTRY.azurecr.io"
client = ContainerRegistryClient(account_url, DefaultAzureCredential())
Key concepts
------------
A **registry** stores Docker images and `OCI Artifacts `_. An image or artifact consists of a **manifest** and **layers**. An image's manifest describes the layers that make up the image, and is uniquely identified by its **digest**. An image can also be "tagged" to give it a human-readable alias. An image or artifact can have zero or more **tags** associated with it, and each tag uniquely identifies the image. A collection of images that share the same name but have different tags, is referred to as a **repository**.
For more information please see `Container Registry Concepts `_.
Examples
--------
.. raw:: html
Troubleshooting
---------------
General
^^^^^^^
Form Recognizer client library will raise exceptions defined in `Azure Core `_.
Logging
^^^^^^^
This library uses the standard
`logging `_ library for logging.
Basic information about HTTP sessions (URLs, headers, etc.) is logged at ``INFO`` level.
Detailed ``DEBUG`` level logging, including request/response bodies and **unredacted**
headers, can be enabled on the client or per-operation with the ``logging_enable`` keyword argument.
See full SDK logging documentation with examples `here `_.
Optional Configuration
^^^^^^^^^^^^^^^^^^^^^^
Optional keyword arguments can be passed in at the client and per-operation level.
The azure-core `reference documentation `_
describes available configurations for retries, logging, transport protocols, and more.
Next steps
----------
.. raw:: html
Contributing
------------
This project welcomes contributions and suggestions. Most contributions require
you to agree to a Contributor License Agreement (CLA) declaring that you have
the right to, and actually do, grant us the rights to use your contribution. For
details, visit `cla.microsoft.com `_.
This project has adopted the `Microsoft Open Source Code of Conduct `_.
For more information see the `Code of Conduct FAQ `_
or contact `opencode@microsoft.com `_ with any
additional questions or comments.
.. image:: https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fsdk%2Fcontainerregistry%2Fazure-containerregistry%2FREADME.png
:target: https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fsdk%2Fcontainerregistry%2Fazure-containerregistry%2FREADME.png
:alt: Impressions
:raw-html-m2r:``
:raw-html-m2r:``
Indices and tables
------------------
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
.. toctree::
:maxdepth: 5
:glob:
:caption: Developer Documentation
azure.containerregistry.rst