2
votes

I am using VSTS build step Docker Compose v 0.* on Hosted Linux Agent. Here is my docker-compose:

version: '3.0'

services:
  storage:
    image: blobstorageemulator:1.1
    ports:
      - "10000:10000"
  server:
    build: .
    environment:
      - ENV=--tests
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - "8080:8080"
    depends_on:
      - storage

I use run services command. So basically I am running 2 Linux containers inside another Linux container (Build Agent). I was able to connect these containers to each other (server uses storage through connection string, which contains storage as a host - http://storage:10000/devstoreaccount1). Question: how to get access to the server from the build agent container? When I do curl http://localhost:8080 on the next step it returns Failed to connect to localhost port 8080: Connection refused. PS Locally I run docker compose and can easily access my exposed port from host OS (I have VirtualBox with Ubuntu 17.10)

UPDATE: I tried using docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' server-container-name to get the IP address of the container running my server app and curl this IP, but I am getting connection timed out now.

1
Try to access it through actual IP (not localhost or 127.0.0.1) mderriey.com/2017/03/06/…starian chen-MSFT
What's the result if you try it with private agent?starian chen-MSFT
@starianchen-MSFT same, can't discover this endpoint.A T
Can you share the detail log on the OneDrive? (set system.debug variable to true, then queue build and share this log)starian chen-MSFT
@AT running on private agent means you have tried with the agent running inside container right?Jitendra

1 Answers

1
votes

there is no way to access it from the host container, you have to perform exec command.

docker-compose -p container_name exec name_from_compose http://localhost:8080