Does your TeamCity agent user have the right permissions to run Docker and Docker Compose? Since your docker-compose command is failing during your build it sounds like there’s an issue running Docker as the agent user. It’d help if you shared any error logs along with the failed docker-compose command.
But I always succeed when I execute
docker-compose ...in the working directory of teamcity on the server.
I suspect this works because the user you logged in as has sufficient permissions to run Docker (e.g., your user is root or is in the Docker group).