siwe-oidc icon indicating copy to clipboard operation
siwe-oidc copied to clipboard

The sample docker-compose.yml requires user to add siwe-oidc entry in their /etc/hosts

Open rht opened this issue 10 months ago • 5 comments

Is there a way to not having to manually edit /etc/hosts in https://github.com/spruceid/siwe-oidc/blob/ec8cc8ed5e6193438d4ac1dc9894653017aa6947/test/docker-compose.yml#L10 ? I often do docker compose down, which resets the IP address. Having to edit this manually every time slows down my debug workflow. Also, I am on NixOS, so /etc/hosts is a symlink to a /nix/store and is editable only by nixos-rebuild or similar commands

I have tried various options, such as

  1. Specifying 127.0.0.1 as the address. This failed with "couldn't connect to server"
  2. Specifying 127.0.0.1 as the address, with network_mode: "host". This failed with siwe-oidc not being able to access the Redis container.
  3. Automatically fetch the container IP address via sudo docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$siwe_container_name" and change SIWEOIDC_BASE_URL to reflect this URL, but this caused the siwe-oidc container to constantly restart.
  4. host.docker.internal (https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach) doesn't work because that address is only for use within the container, not from the host.

rht avatar Apr 04 '24 04:04 rht