-
-
Notifications
You must be signed in to change notification settings - Fork 248
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
Support for host.docker.internal #93
Comments
How do you propose we fix this on a container? This is something the docker engine has to support, and since you did not fill the issue template completely, I cant tell if the version you are on supports it. |
This feature, using special DNS entry version: "3.3"
services:
swag:
image: linuxserver/swag
container_name: swag
cap_add:
- NET_ADMIN
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Berlin
- URL=example.com
- SUBDOMAINS=my-subdomain-here
- ONLY_SUBDOMAINS=true
- VALIDATION=dns
- DNSPLUGIN=cloudflare
- DHLEVEL=2048 #optional
- STAGING=false #optional
- PROPAGATION=60
volumes:
- /appdata/volumes/swag:/config
ports:
- 443:443
- 80:80 #optional
restart: always
extra_hosts:
- "host.docker.internal:host-gateway" do a
However, if I configure something like this inside a nginx proxy-config, it does not work the same as it works with curl:
It does work, if I replace the line |
While I'm updating my laptop, looking at the PR that add it mentions that you might need |
I missed that you had that in your compose, my bad |
DIG nor nslookup actually resolves this, which is the culprit. All docker is doing is adding it to the host file, which their embedded DNS server happily ignores. |
How can we solve this? I have the same problem. BTW curl for some reason works ?.? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I don't believe it's possible to solve this issue with the current implementation of host.docker.internal on Linux as it directly modifies the local hosts file in the container and nginx does not and will not use that for name resolution. |
Adjust DNS config / nginx within swag to allow resolution "special DNS" name
host.docker.internal
(which points usally to 172.17.0.1). This "special DNS" "entry" is baked-in functionality of the docker engine in versions 20.10 and above (Linux)Desired Behavior
Support
host.docker.internal
inside proxy-configs. This "magic" DNS name points to 172.17.0.1, if docker was configured especially. See https://stackoverflow.com/a/43541681.Current Behavior
At the moment I need to set the IP 172.17.0.1 to direct traffic to the HOST. The setting "host.docker.internal" is not working at the moment (e.g. for passing traffic to a container running in host mode from swag instance, running in "bridge" network mode. Only 172.17.0.1 is working if one needs to access a container with network_mode "host" from a swag instance running with network_mode "bridge".
Alternatives Considered
Use 172.17.0.1 instead of "host.docker.internal". This works, but why not support docker backed-in DNS magic regarding "host.docker.internal" entry (which should resolve to 172.17.0.1).
The text was updated successfully, but these errors were encountered: