We are using microservices approach to build our product. We are using some projects which each uses docker-compose to run. The problem is that in development environment, i
Am not 100% sure on your question so this will be a wide answer.
1) Everything can be in the same compose file if it's running on the same machine or server cluster.
#proxy
haproxy:
image: haproxy:latest
ports:
- 80:80
#setup 1
ubuntu_1:
image: ubuntu
links:
- db_1:mysql
ports:
- 80
db1:
image: ubuntu
environment:
MYSQL_ROOT_PASSWORD: 123
#setup 2
ubuntu_2:
image: ubuntu
links:
- db_2:mysql
ports:
- 80
db2:
image: ubuntu
environment:
MYSQL_ROOT_PASSWORD: 123
It's also possible to combine several yml files like
$docker-compose -f [File A].yml -f [File B].yml up -d
2) Every container in the build can be controlled separately with compose.
$docker-compose stop/start/build/ ubuntu_1
3) Using $docker-compose build it will only rebuild where changes have been done.
Here is more information that could be useful https://docs.docker.com/compose/extends/#extending-services
If none of above is correct please example of build.