Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use docker swarm hostname instead of localhost? #113

Open
zx9088 opened this issue Jul 5, 2023 · 2 comments
Open

How to use docker swarm hostname instead of localhost? #113

zx9088 opened this issue Jul 5, 2023 · 2 comments

Comments

@zx9088
Copy link

zx9088 commented Jul 5, 2023

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?

@SthPhoenix
Copy link
Owner

SthPhoenix commented Jul 5, 2023

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

@zx9088
Copy link
Author

zx9088 commented Jul 6, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants