Streamlining Container Image Pulls: Mastering Docker Media Types with Azure Container Registry


When working with containerized applications in Azure, the Azure Container Registry (ACR) is a powerful tool for managing and distributing container images. However, when pulling images over a private network, such as a Virtual Network (VNet), it’s crucial to understand the role of media types in ensuring compatibility and seamless operations. This blog post explores why using Docker media types is essential in this scenario and provides actionable recommendations for developers.
Understanding Media Types in Container Images
Container images can be stored and distributed using different media types. The two most common formats are:
Docker Media Types: These are the traditional media types used by Docker, such as
application/vnd.docker.distribution.manifest.v2+json
.OCI Media Types: These are part of the Open Container Initiative (OCI) specification, such as
application/vnd.oci.image.manifest.v1+json
.
While OCI media types are gaining popularity due to their open standardization, they are not universally supported in all environments.
Why Docker Media Types Are Necessary for ACR Over Private Networks
When pulling container images from Azure Container Registry over a private network (e.g., using a VNet), OCI media types are not supported. This limitation can lead to failed image pulls or unexpected behavior. Here’s why Docker media types are the preferred choice:
Compatibility with Azure Networking: Azure’s private networking stack, including VNets, is optimized for Docker media types. OCI media types may not be recognized, causing issues during image pulls.
Seamless Integration with Docker Tools: Docker media types are natively supported by Docker CLI and Docker Desktop, ensuring a smooth developer experience.
Avoiding Runtime Errors: Using Docker media types prevents runtime errors when deploying containerized applications in environments that rely on private networking.
Best Practices for Pulling Images from ACR Over a Private Network
To ensure a smooth experience when pulling images from ACR over a private network, follow these best practices:
1. Use Docker Media Types
When building and pushing images to ACR, ensure that the images are stored using Docker media types. This can be achieved by configuring your build tools to use Docker’s default media types instead of OCI. If you need to convert an image to a different media type, use Docker’s buildx
tool with the appropriate exporter. For example:
docker buildx build --output type=docker,name=myimage:latest .
2. Disable Containerd in Docker Desktop
If you’re using Docker Desktop, disable the containerd runtime option. Containerd is optimized for OCI media types, which are not supported over VNets in Azure. To disable containerd:
Open Docker Desktop settings.
Navigate to the Experimental Features section.
Uncheck the Enable containerd option.
Restart Docker Desktop.
3. Validate Image Compatibility
Before deploying images, validate that they are using Docker media types. You can inspect the image manifest using the docker manifest inspect
command to confirm the media type.
docker manifest inspect <image-name>
Look for the mediaType
field in the output and ensure it matches Docker’s media type (application/vnd.docker.distribution.manifest.v2+json
).
4. Leverage Private Endpoints
When pulling images over a private network, configure a private endpoint for your Azure Container Registry. This ensures that all traffic remains within the Azure network, enhancing security and performance.
Key Takeaways
OCI media types are not supported when pulling container images from Azure Container Registry over a private network.
Always use Docker media types to ensure compatibility and avoid runtime errors.
Disable the containerd option in Docker Desktop to prevent issues with OCI media types.
Validate your image manifests and configure private endpoints for secure and efficient image pulls.
By following these best practices, you can ensure a seamless experience when working with Azure Container Registry in private networking scenarios.
Subscribe to my newsletter
Read articles from Pratik Panda directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Pratik Panda
Pratik Panda
Hi there! 👋 I am a Consultant in Cloud Application Development at Microsoft. Things I primarily work on include (but not limited to) the following: Architecting and developing distributed cloud-native systems on Azure. Crafting robust application frameworks and architectures. Programming with C# and leveraging the .NET ecosystem. Implementing Kubernetes and containerization for scalable solutions. Streamlining processes through DevOps methodologies.