How to connect to services started with docker-compose up -d

If you ever need to connect to some services started with docker-compose up -d in some steps, you can do the following in a script step:

#!/bin/bash
set -ex
CID=`docker ps -q`
docker-compose up -d
docker network connect src_default ${CID}

This will effectively connect the bitrise image running your steps to the network docker-compose has setup allowing you to reach the services it exposes using their names in later steps.

1 Like

Awesome tip/trick, thanks for sharing @Tlvenn! :wink: