How to use docker swarm hostname instead of localhost?
zx9088 opened this issue · comments
We know the service can be accessed using localhost:18081.
However, if we use docker swarm to create the container and name it 'insightface', and assign the port map 18081:18080, the url insightface:18080 does not work.
The error message is : InvalidSchema: No connection adapters were found for 'insightface:18080/extract'.
The container is surely pingable and we tried to use docker exec -it to enter and netstat it, the port listening is indeed 18080.
Is there a way to correctly access the service using swarm hostname?
Hi! I haven't tested it in swarm, but this error usually means that you are missing protocol during request, so try just calling api by full address like http://insightface:18080/extract
Also swarm uses names for internal communication, so you probably won't be able to access internal port 18080 and hostname from outside of the swarm network
Hi! I haven't tested it in swarm, but this error usually means that you are missing protocol during request, so try just calling api by full address like http://insightface:18080/extract
Also swarm uses names for internal communication, so you probably won't be able to access internal port 18080 and hostname from outside of the swarm network
Thank you so much for the quick response! I tried http://insightface:18080/extract and it worked.