Kernel: 6.2.0-33-generic
OS: Ubuntu 22.04.1
Docker: 24.0.6 (from Ubuntu repo)
Compose variable ELASTALERT_INSTANCE_NAME = "elastalert_blueteam01"
I have an issue which is puzzling me somewhat
I have a compose file with the following networks:
elastalert_${ELASTALERT_INSTANCE_NAME}:
driver: bridge
es_network:
name: ${ES_NETWORK}
external: true
One of the services (âelastalert_blueteam01â in this case) uses both:
- es_network
- elastalert_${ELASTALERT_INSTANCE_NAME}
The other (âfrontendâ) uses only one:
- elastalert_${ELASTALERT_INSTANCE_NAME}
The âes_networkâ is running an Elastic-stack (Elasticsearch stack) and is only used by âelastalertâ in this compose file. However, the âfrontendâ service uses the âelastalertâ network above.
If I issue a docker network ls
command it shows like this:
NETWORK ID NAME DRIVER SCOPE
84660b1762b6 elastalert_blueteam01 bridge local
and a docker network ls
gives:
[
{
"Name": "elastalert_blueteam01",
"Id": "84660b1762b6031a25a387798883b7627949ca1ab997008991f666460abd2bd9",
"Created": "2023-10-06T09:45:46.639444919+02:00",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": {},
"Config": [
{
"Subnet": "172.21.0.0/16",
"Gateway": "172.21.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {},
"Options": {},
"Labels": {}
}
]
When I issue docker compose up
I get an
service "elastalert" refers to undefined network elastalert_blueteam01: invalid compose project
error. I thought compose allowed âdynamicâ network mappings based on env-variables. What am I missing here?
Although this is not a âshow stopperâ for me it would be great to be able to âhideâ the traffic between elastalert_xxx and frontend services. Keeping it on the bridged network I may use the same ports although I might deploy additional copies (with their own âelastalert_xxxxâ bridged network). If I canât solve this Iâll have to perform some portmappings with different mappings/deployment. Doable but not so funny and very error prone although Iâll provision with, say, ansible.
Really hope there are some more seasoned Docker gurus out there