When I run a docker-compose command on the CLI, it looks like this:
docker-compose up -d my-service
# Recreating my-cluster_my-service_1 ... done
However, capturing the output seems to break it:
foo=$(docker-compose up -d my-service 2>&1)
echo $foo # <-- this line actually vanishes!
# Recreating my-cluster_my-service_1 ... done
# ecreating my-cluster_my-service_1 ...
Note how we have to re-direct stderr because, for some reason, docker-compose outputs there instead of stdout.
This makes it hard to handle output of docker-compose programmatically. How can I get the correct output of docker-compose?