3

I'm trying to run a container job running inside a locally built and cached Docker image (from a Dockerfile) instead of pulling the image from registry. Based on my tests so far, the agent only tries to pull the image from a registry and doesn't search the image locally. I know this functionality is not documented, however I wonder if there is a way to make it work.

stages:
- stage: Build 
  jobs:
  - job: Docker
    steps:
    - script: |
        docker build -t builder:0.1 .
      displayName: 'Build Docker'
  
  - job: GCC
    dependsOn: Build
    container: builder:0.1
    steps:
    - script: |
        cd src
        make
      displayName: 'Run GCC'

1 Answer 1

1

I am afraid there is no such way to find the locally cached image and run a container job on it for the time being.

From the documentation you mentioned:

Containers can be hosted on registries other than Docker Hub. To host an image on Azure Container Registry or another private container registry

If you define a container in YAML file, it will extract the image from the docker hub by default.

Or you can add the endpoint field to specify other registry(e.g. Azure Container Registry).

Here is the definition of the Container:

container:
  image: string  # container image name
  options: string  # arguments to pass to container at startup
  endpoint: string  # endpoint for a private container registry
  env: { string: string }  # list of environment variables to add

This means that the container job will directly extract the image from the registry and cannot search the local cache.

But this requirement is valuable.

You could add your request for this feature on our UserVoice site, which is our main forum for product suggestions.

Sign up to request clarification or add additional context in comments.

1 Comment

Is there an update on this? I think this a valuable functionality. Especially given that the endpoint definition does not support Amazon ECR, we don't have a choice but to pull an image from ECR in a separate job and then use this (locally cached) image in a container job. I hope this feature request is prioritized.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.