I'm a bit confused on how to setup my environment with docker-compose. I want to have the following:
I want to stop/start/build the ELK stack container independently from the containers of the web applications A/B. But i would like to link the containers to the ELK stack container to open the connection for filebeat.
What I'm looking for would be like this:
Is this somehow possible. I did not get it to work with extends or link.
Thanks in advance
Docker networking is the key here. You can do:
$ docker network create some-net
Then in your compose files, add the following to the bottom:
networks:
default:
external:
name: some-net
This will set the default network (for each container) to be a previously defined network (some-net). All containers (regardless of the compose file they were defined in) should then be able to communicate with each other using the built-in service name DNS resolution.
Relevant docs: https://docs.docker.com/compose/networking/#/using-a-pre-existing-network
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With