Pages

How to get two docker-compose services to talk to each other

Imagine you have two services that are started by two different docker-compose files. And you would like these two services to talk to each other. How can we achieve this?

Why would you want to do this in the first place?

I had a use-case for this, that's why! The use case was as follows:

I have a docker-compose file that contains linux-swag and mysql. These are resources that are not updated very often. So I can start them and forget about them.

I have another docker-compose file that contains a Spring Boot application. This application can have different versions (prod, staging, dev). And these version get automatically deployed on each git-push.