skip to Main Content

I am trying to pull Docker container in my Azure pipeline. Azure pipeline is running on the self hosted agent, that is running in the docker container. I get a following error:
enter image description here

Is it possible to run the container in the pipeline, when the pipeline itself runs on the container self hosted agent?

Pipeline YAML:


# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://learn.microsoft.com/azure/devops/pipelines/languages/javascript

trigger:
- master

resources:
  containers:
  - container: qmate
    image: qmate.int.repositories.cloud.sap/qmate-executor:latest

pool:
  vmImage: ubuntu-latest
  name: SYS-DEV-Self-hosted
  demands:
    - agent.name -equals SYSDEV-agent
    
steps:
- task: NodeTool@0
  inputs:
    versionSpec: '15.x'
  displayName: 'Install Node.js'

- task: DockerInstaller@0
  inputs:
    dockerVersion: '17.09.0-ce'

- script:  docker pull qmate
  workingDirectory: ./
  displayName: 'Docker Pull'

- script: |
    cd tests/QmateE2E/regression
    npm install
    npx wdio config.js
    displayName: 'npm install and build'

2

Answers


  1. You may configure the self-hosted agent in the docker container.
    You don’t need to run the docker container in the pipeline. You could install the self-hosted agent in the docker instance.
    And then make the docker container as a self-hosted which can be set in the agent pool.

    Login or Signup to reply.
  2. You can specify multiple containers to run with the container jobs… (If you want to run another container to interact with) (The container that you specify on the pipeline would be pulled and started automatically by Azure Devops) (I would normally specify the container to run on in a top-level container: or for one under the specific job, if multiple jobs are present.)

    (The way it is done currently, the safe option, in case more containers are added, is to have a target: qmate for each of the steps that should run in the container)

    For the error you had here: For steps that interact with docker, like docker build, you can also set target: host on the specific task. (Azure DevOps seems to mount stuff to allow most of the context to be shared) (in this case the image that you are trying to pull was likely already pulled when the pipeline started)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search