-
Notifications
You must be signed in to change notification settings - Fork 6.7k
External applications
This page describes how to consume the ELK services from applications started outside of the ELK stack Compose.
Docker Compose creates a bridge network used by the services from the ELK stack. This network is named after the directory that contains the docker-compose.yml
file (without hyphens or underscores), followed by the predefined network name _elk
.
For instance, if you cloned the repository inside a directory called elk-stack
, the name of the bridge network dedicated to the ELK stack will be elkstack_elk
.
To list the networks available to Docker, execute the following command:
❯ docker network ls
NETWORK ID NAME DRIVER SCOPE
4e7f482eec96 bridge bridge local
16a574ecd253 dockerelk_elk bridge local
6507e865135e host host local
87535838ad3a none null local
In order to be able to communicate with the services from the ELK stack, external containers must be connected to the same bridge network as the one used by these services.
From the Docker CLI, this translates to:
❯ docker run --name myapp --network dockerelk_elk nginx:alpine
In a Docker Compose file, one can specify external
networks in order to use networks created outside of the current Compose:
# docker-compose.yml
services:
myapp:
image: nginx:alpine
networks:
- elk
networks:
elk:
external:
name: dockerelk_elk
In both cases, one can verify that the name of the ELK services can actually be resolved from the newly created container:
❯ docker exec myapp nslookup logstash
Server: 127.0.0.11
Address: 127.0.0.11#53
Non-authoritative answer:
Name: logstash
Address: 172.18.0.3
Cerebro is a web administration tool for Elasticsearch. It replaces the older kopf plugin.
Launch the application with the following Docker Compose file:
# docker-compose.yml
version: '3'
services:
cerebro:
image: yannart/cerebro
ports:
- "9000:9000"
networks:
- elk
networks:
elk:
external:
name: dockerelk_elk
Open your browser at the following address: https://localhost:9000, and use the following host address in the Hosts field: https://elasticsearch:9200
.