Share via


resources.containers.container definition

A container resource references a container image.

containers:
- container: string # Required as first property. Alias of the container.
  endpoint: string # ID of the service endpoint connecting to a private container registry.
  azureSubscription: string # Azure subscription (ARM service connection) for container registry.
  resourceGroup: string # Resource group for your ACR.
  registry: string # Registry for container images.
  repository: string # Name of the container image repository in ACR.
  localImage: boolean # When true, uses a locally tagged image instead of using docker pull to get the image. The default is false.

Definitions that reference this definition: resources.containers

Properties

container string. Required as first property.
ID for the container. Acceptable values: [-_A-Za-z0-9]*.

endpoint string.
ID of the service endpoint connecting to a private container registry.

azureSubscription string.
Azure subscription (ARM service connection) for container registry.

resourceGroup string.
Resource group for your ACR.

registry string.
Registry for container images.

repository string.
Name of the container image repository in ACR.

localImage boolean.
When true, uses a locally tagged image instead of using docker pull to get the image. The default is false.

This property is useful only for self-hosted agents where the image is already present on the agent machine.

Remarks

Container jobs let you isolate your tools and dependencies inside a container.

The agent launches an instance of your specified container then runs steps inside it. The container keyword lets you specify your container images.

Service containers run alongside a job to provide various dependencies like databases.

Examples

resources:
  containers:
  - container: linux
    image: ubuntu:16.04
  - container: windows
    image: myprivate.azurecr.io/windowsservercore:1803
    endpoint: my_acr_connection
  - container: my_service
    image: my_service:tag
    ports:
    - 8080:80 # bind container port 80 to 8080 on the host machine
    - 6379 # bind container port 6379 to a random available port on the host machine
    volumes:
    - /src/dir:/dst/dir # mount /src/dir on the host into /dst/dir in the container

See also

Define resources in YAML