Skip to content

Gin (Golang) server cannot connect to self-hosted Ory Kratos ports within main.go file: connection refused #3758

Answered by Nikola-Milovic
paigen11 asked this question in Q&A
Discussion options

You must be logged in to vote

Sorry, if you havent already resolved this, but to confirm. You have kratos running locally on your machine outside of the docker compose (can't see it defined there) and the service app running inside the docker compose thats trying to connect to it.

I am on my phone so please correct me.

If this is the case, trying to connect to 127.0.0.1 will just route to the localhost of the container. The internal.docker.host works if you add the extra_hosts option. (But wouldnt recommend it, for me its always behaving weirdly)

An easy fix should be to add kratos to the docker compose as a service and connect to it via http://kratos:<port>

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@paigen11
Comment options

@Nikola-Milovic
Comment options

@paigen11
Comment options

@Nikola-Milovic
Comment options

@paigen11
Comment options

Answer selected by paigen11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants