Reputation: 4103
I have created a docker swarm and trying to use overlay network in order to communicate between the 2 services deployed over that swarm. the Docker compose of 1 service looks like:
version: '3'
services:
web:
container_name: "eureka"
image: eureka
environment:
EUREKA_HOST: eureka
ports:
- 8070:8070
networks:
- net_swarm
networks:
net_swarm:
external:
name: net_swarm
Second :
version: '3'
services:
web:
image: zuul-service
environment:
EUREKA_HOST: eureka_web
ports:
- 8069:8069
networks:
- net_swarm
networks:
net_swarm:
external:
name: net_swarm
i did a docker deploy --compose-file docker-compose.yml eureka
to create the service 1, which spun up with service name as eureka_web, as seen above the same is referenced in the compose file of service 2 as EUREKA_HOSTS, however since this "eureka_web" has an underscore the host isnt getting picked when trying to run the second file.(primarily becoz of the underscore)
Can i somehow override the underscore in the service name or is there any other work around?
Upvotes: 2
Views: 1399
Reputation: 684
Don't give the container name.
So that your service name will act as the host name.
Also the host name with underscores should not cause any problem. Try finding out the actual rootcause.
Edit: Your service name and the host name is web. And I can't say about this line, without looking at the docker file.
environment:
EUREKA_HOST: eureka
Upvotes: 1