Skip to content

Accessing host.docker.internal from a container #21986

Open
@kaisersly

Description

@kaisersly

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/engineIssue affects Docker engine/daemon

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions