Accessing host.docker.internal from a container
Nobody has claimed this yet.
- Dominant language
- Markdown
- Stars
- 4.7k
- Forks
- 8.5k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 108
Description
Is this a docs issue?
- My issue is about the documentation content or website
Type of issue
I can't find what I'm looking for
Description
I have a service running on my host (python -m http.server 8111), I can't reach it from a container using host.docker.internal (curl http://host.docker.internal:8111 -> curl: (7) Failed to connect to host.docker.internal port 8111 after 0 ms: Couldn't connect to server).
To achieve this, I had to create two configuration files :
~/.config/systemd/user/docker.service.d/override.conf
[Service]
Environment="DOCKERD_ROOTLESS_ROOTLESSKIT_DISABLE_HOST_LOOPBACK=false"
~/.config/docker/daemon.json
{ "host-gateway-ip": "10.0.2.2" }
Location
https://docs.docker.com/engine/security/rootless/
Suggestion
It would be great if the problem and the solution appeared directly on the rootless page.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the rootless Docker page at https://docs.docker.com/engine/security/rootless/ and review the reported host.docker.internal behavior and configuration snippets. Document the problem and the stated solution there; done means users can find guidance for reaching a host service from a rootless container.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100