InsightFace-REST icon indicating copy to clipboard operation
InsightFace-REST copied to clipboard

How to use docker swarm hostname instead of localhost?

Open zx9088 opened this issue 2 years ago • 2 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?

zx9088 avatar Jul 05 '23 17:07 zx9088

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

SthPhoenix avatar Jul 05 '23 18:07 SthPhoenix

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.

zx9088 avatar Jul 06 '23 07:07 zx9088