Azure Pipelines "Container failed to initialize"
A container job or container resource could not start. The image reference is wrong, the registry pull failed (auth or a transient network blip), or the agent OS does not support that container.
What this error means
A job using a container: resource fails during initialization with Container <name> failed to initialize, often preceded by a docker pull or docker create error. The job never reaches your steps.
##[error]Container 'node:18' failed to initialize.
Error response from daemon: pull access denied for myregistry/app,
repository does not exist or may require 'docker login'.Common causes
Image not found or private registry not authenticated
A misspelled tag or a private image without a configured container registry service connection makes the pull fail, so the container never starts.
Unsupported container/agent combination
Windows container images on a Linux agent (or vice versa), or container jobs on an agent without Docker, cannot initialize.
How to fix it
Authenticate the registry via an endpoint
For private images, reference a Docker registry service connection so the agent can pull.
resources:
containers:
- container: app
image: myregistry.azurecr.io/app:1.0
endpoint: my-acr-connection
jobs:
- job: build
container: appMatch the container OS to the agent
- Use a Linux image on a Linux (
ubuntu-latest) agent and a Windows image on a Windows agent. - Confirm the agent has Docker installed (Microsoft-hosted Linux images do).
- Re-run if the failure was a transient registry/network blip - pulls often succeed on retry.
How to prevent it
- Reference private images through a registry service connection.
- Match container image OS to the agent pool image.
- Pin image tags you know exist and are pullable.