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.