Azure-devops-docs: Examples of Service Containers do not work

Created on 9 May 2019  Â·  7Comments  Â·  Source: MicrosoftDocs/azure-devops-docs

I picked the sample above and pasted it in a pipeline, but was not able to execute the pipeline. The error I get when I use the nginx and redis pipeline is when the apt get command is run.

[command]/bin/bash --noprofile --norc /home/vsts/work/_temp/683b6fb6-dbe3-4dea-a205-d102ee22e8bf.sh

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
/home/vsts/work/_temp/683b6fb6-dbe3-4dea-a205-d102ee22e8bf.sh: line 2: psql: command not found

On changing the command to run as sudo, the challenge is Ubuntu 16 onwards does not have sudo installed and since apt-get does not work cannot install it either. As a workaround I am using the vsts ubuntu 14.04 image but that increases the build time.

The documentation needs to be corrected or please identify if I am doing something wrong.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri2 devops-cictech devopprod doc-bug stale-issue

Most helpful comment

The container job example does not work because the ubuntu container is not running as root user so you can't run apt-get. It would be nice if the examples were valid

All 7 comments

@thomps23 please assign to @dakale

I got the same problem here

It seems that I can define 'services' only under 'jobs' according to the document about YAML schema ( https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#server )
So I think those examples in this article don't work in the first place. (Actually, it didn't on my env.)

How did you guys write your .yml?

The following didn't work for me:

resources:
containers:

  • container: sql
    image: mcr.microsoft.com/mssql/server
    ports:

    • 8080:80

      env:

      SA_PASSWORD: "*"

      ACCEPT_EULA: "Y"

  • container: api
    image: my-api:latest
    ports:

    • 8080:80

      env:

      connectionString: "Server=tcp:sql,1433;Initial Catalog=my-db;Persist Security Info=False;User ID=sa;Password=*;MultipleActiveResultSets=False;Connection Timeout=30;"

      services:

      sql: sql

      api: api

      pool:

      vmImage: 'ubuntu-16.04'

      steps:

    • script: |

      ping localhost -c 10

      curl localhost:8080

The container job example does not work because the ubuntu container is not running as root user so you can't run apt-get. It would be nice if the examples were valid

This issue hasn't been updated in more than 180 days, so we've closed it. If you feel the issue is still relevant and needs fixed, please reopen it and we'll take another look. We appreciate your feedback and apologize for any inconvenience.

The documentation is still wrong.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

atrauzzi picture atrauzzi  Â·  3Comments

o-o00o-o picture o-o00o-o  Â·  3Comments

sevaa picture sevaa  Â·  3Comments

anlatsko picture anlatsko  Â·  3Comments

KacperMucha picture KacperMucha  Â·  3Comments