azure-pipelines-agent: Problem on connecting to services
Agent Version and Platform
Version of your agent? 2.144.0/2.144.1/…
Agent name: ‘Hosted Agent’ Agent machine name: ‘fv-az712’ Current agent version: ‘2.164.8’ Current image version: ‘20200211.1’ Agent running as: ‘vsts’ Prepare build directory. Set build variables. Download all required tasks.
Azure DevOps Type and Version
dev.azure.com https://dev.azure.com/manpremo
What’s not working?
Please include error messages and screenshots.
Starting since some days ago a working pipeline as stopped to work because. Inside my tasj I’m using a postgres service and now the service is not more resolved at network level.
I have create a simple pipeline where I try to connect to postgres and I get this error:
psql: could not translate host name "postgres" to address: Name or service not known
resources:
containers:
- container: postgres
image: postgres:latest
- container: u18
image: ubuntu:18.04
options: '-v /usr/bin/sudo:/usr/bin/sudo -v /usr/lib/sudo/libsudo_util.so.0:/usr/lib/sudo/libsudo_util.so.0 -v /usr/lib/sudo/sudoers.so:/usr/lib/sudo/sudoers.so -v /etc/sudoers:/etc/sudoers'
stages:
- stage: xxx
jobs:
- job: yyy
container: u18
services:
postgres: postgres
steps:
- script: |
sudo apt update
sudo apt install -y postgresql-client
psql --host=postgres --username=postgres --command="SELECT 1;"
Agent and Worker’s Diagnostic Logs
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 5
- Comments: 24 (7 by maintainers)
This issue is still persistent with postgres:13 and its more a problem of readiness i would say, because docker container is started only right before the first tag? is executed and not yet ready. Why does azure devops not make sure that the host is registered in the network and listening on exposed port before continued.
It could be that the container is crashing immediately.
Anyhow, this is how I got it working:
This issue has had no activity in 180 days. Please comment if it is not actually stale
I’m running a docker-compose inside a pipeline with a postgres image and have been suffering from a similar issue. Switching from
postgres:11.7-alpine
topostgres:11.5-alpine
appears to have solved the issue, at least temporarily.