I'm new to swarm and trying to figure how can I set service name in order to access containers from different nodes.
I'm using docker-compose file:
version: '3.1'
services:
service-ui:
image: service-ui:release
deploy:
placement:
constraints:
- node.role == manager
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 5
ports:
- "443:443"
docker deploy -c docker-compose.yml stackname to bring the stack up.
My service name is being generated to the following format: stackname_servicename.1, while I access it by ServiceName. how do set an constant name for a service in swarm mode?
inside the same compose file all services are available with the serviceName to each other , because there is internal DNS.
In you file you have service bigid-ui
that is the the DNS record for all services of this type, so even when you scale your app once you will get bigid-ui.1 and other time bigid-ui.2 but both have dns record just bigid-ui.
This name is available only to other services in same compose file. and if you do docker ps -a
it will show you the stackanme_bigid-ui.1 which is correct.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.