Dela via


resources.containers.container definition

En containerresurs refererar till en containeravbildning.

containers:
- container: string # Required as first property. Alias of the container.
  image: string # Required. Container image tag.
  type: string # Type of the registry like ACR or GCR.
  trigger: trigger | none | true # Specify none to disable, true to trigger on all image tags, or use the full syntax as described in the following examples.
  endpoint: string # ID of the service endpoint connecting to a private container registry.
  env: # Variables to map into the container's environment.
    string: string # Name/value pairs
  mapDockerSocket: boolean # Set this flag to false to force the agent not to setup the /var/run/docker.sock volume on container jobs.
  options: string # Options to pass into container host.
  ports: [ string ] # Ports to expose on the container.
  volumes: [ string ] # Volumes to mount on the container.
  mountReadOnly: # Volumes to mount read-only, the default is all false.
    work: boolean # Mount the work directory as readonly.
    externals: boolean # Mount the externals directory as readonly.
    tools: boolean # Mount the tools directory as readonly.
    tasks: boolean # Mount the tasks directory as readonly.
  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.
containers:
- container: string # Required as first property. Alias of the container.
  type: string # Type of the registry like ACR or GCR.
  endpoint: string # ID of the service endpoint connecting to a private container registry.
  trigger: trigger | none | true # Specify none to disable, true to trigger on all image tags, or use the full syntax as described in the following examples.
  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.

Definitioner som refererar till den här definitionen: resources.containers

Egenskaper

container sträng. Krävs som första egenskap.
ID för containern. Godtagbara värden: [-_A-Za-z0-9]*.

image sträng. Obligatoriskt.
tagg för containeravbildning.

type sträng.
typ av registret som ACR eller GCR.

trigger resources.containers.container.trigger.
Ange ingen att inaktivera, sant att utlösa på alla bildtaggar eller använd den fullständiga syntaxen enligt beskrivningen i följande exempel.

endpoint sträng.
ID för tjänstslutpunkten som ansluter till ett privat containerregister. Malluttryck stöds.

endpoint sträng.
ID för tjänstslutpunkten som ansluter till ett privat containerregister.

env strängordlista.
variabler som ska mappas till containerns miljö.

mapDockerSocket boolesk.
Ange den här flaggan till false för att tvinga agenten att inte konfigurera volymen /var/run/docker.sock på containerjobb.

options sträng.
Alternativ för att skicka till containervärden. Malluttryck stöds.

options sträng.
Alternativ för att skicka till containervärden.

ports stränglista.
portar som ska exponeras i containern. Malluttryck stöds.

ports stränglista.
portar som ska exponeras i containern.

volumes stränglista.
Volymer som ska monteras på containern. Malluttryck stöds.

volumes stränglista.
Volymer som ska monteras på containern.

mountReadOnly mountReadOnly.
Volymer för att montera skrivskyddad är standardvärdet falskt.

azureSubscription sträng.
Azure-prenumeration (ARM-tjänstanslutning) för containerregistret.

resourceGroup sträng.
resursgrupp för din ACR.

registry sträng.
Registry för containeravbildningar.

repository sträng.
Namnet på containeravbildningslagringsplatsen i ACR.

localImage boolesk.
När sant använder en lokalt taggad avbildning i stället för att använda docker pull för att hämta avbildningen. Standardvärdet är falskt.

Den här egenskapen är endast användbar för lokalt installerade agenter där avbildningen redan finns på agentdatorn.

Anmärkningar

containerjobb kan du isolera dina verktyg och beroenden i en container.

Agenten startar en instans av den specificerade containern och kör sedan åtgärder inuti den. Med nyckelordet container kan du ange dina containeravbildningar.

Tjänstcontainrar köras tillsammans med ett jobb för att tillhandahålla olika beroenden som databaser.

Malluttryck stöds för egenskaperna endpoint, volumes, portsoch options för en containerresurs i en YAML-pipeline.

Exempel

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

Se även

Definiera resurser i YAML-