Gin (Golang) server cannot connect to self-hosted Ory Kratos ports within main.go
file: connection refused
#3758
-
Hello, I'm attempting to build an authentication service that uses a Gin-powered Go server to interface with a self-hosted Ory Kratos instance and will eventually have a Sveltekit UI for users to register, login, view their accounts, etc. After going through the docs and quickstart for self-hosted Ory Kratos many times (and running the local version of the quickstart repo and poring over that code as well), I started building my own. I'm using Docker to build my Gin Go server, Docker Compose to spin up all the necessary pieces: the PostgresDB, the Kratos SQL migration, the MailSlurper SMTP server, and generally trying to do things in a similar fashion to the quickstart, however, when I try to cURL any Ory Kratos command via the API or the I've tried changing the Kratos If someone's willing to help, I can also make a copy of the repo available for public consumption as well. Any help from someone with a better handle on this technology is greatly appreciated. For reference, here is the Dockerfile and
And the
Here is my
And
And here is the
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
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 I am on my phone so please correct me. If this is the case, trying to connect to An easy fix should be to add kratos to the docker compose as a service and connect to it via |
Beta Was this translation helpful? Give feedback.
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. Theinternal.docker.host
works if you add theextra_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>