1

When running my azure pipeline I run into the below error when trying to initialize a container.

OCI runtime exec failed: exec failed: container_linux.go:367: starting container process caused: exec: "useradd": executable file not found in $PATH: unknown

The snippet of the pipeline where it fails

resources:
  containers:
  - container: linux2
    image: amazonlinux:latest
    options: --user 0:0

stages:
  - stage: build_stage    
    pool:
      vmImage: 'ubuntu-latest'
      demands:
        - msbuild
        - visualstudio
        - vstest
    
    jobs:
      - job: build_job

        container: linux2

        steps:
          - checkout: self
            clean: true

This seems like it could potentially be a permissions issue but I'm really not sure.

1 Answer 1

1

It is because amazonlinux:latest doesn't have useradd command.

AzDev creates the container from the image, then it adds a new user and add this user to sudoers file (even if you don't have sudo in your image), and only after that it runs the container.

So the easiest approach is just to change an image. Also you can take amazonlinux:latest and add useradd and use it in your pipeline.

1
  • Ok I see, that makes sense thank you very much. I need the amazonlinux image because I need the image to match the OS of the deployment environment but what you've said now will give me a way to go forward. Thank you Mar 5, 2021 at 10:28

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.