8000 can't connect to host.docker.internal · Issue #902 · abiosoft/colima · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
can't connect to host.docker.internal #902
Closed
@dbarrosop

Description

@dbarrosop

Description

Not sure what changed between 0.6.2 and 0.6.5 but on <=0.6.2 I could add on my docker-compose file:

        extra_hosts:
            - host.docker.internal:host-gateway

and then run a service on my laptop and connect from the container directly to it via that name. For instance, if I had on my laptop a service running on :8080 from the container I could simply do curl http://host.docker.internal:8080. Now on 0.6.5 I get "connection refused". I noticed that curl http://192.168.5.2:8080 works but I don't think hardcoding IPs is a good solution, specially when sharing the docker-compose file with others.

Version

colima version 0.6.5
git commit: dev

runtime: docker
arch: aarch64
client: v20.10.25
server: v24.0.7
limactl version 0.18.0

qemu-img version 8.1.2
Copyright (c) 2003-2023 Fabrice Bellard and the QEMU Project developers

Operating System

  • macOS Intel <= 13 (Ventura)
  • macOS Intel >= 14 (Sonoma)
  • Apple Silicon <= 13 (Ventura)
  • Apple Silicon >= 14 (Sonoma)
  • Linux

Output of colima status

colima status
INFO[0000] colima is running using macOS Virtualization.Framework
INFO[0000] arch: aarch64
INFO[0000] runtime: docker
INFO[0000] mountType: virtiofs
INFO[0000] socket: unix:///Users/dbarroso/.colima/default/docker.sock

Reproduction Steps

  1. On your laptop run nc -l 8080
  2. docker run --rm --add-host=host.docker.internal:host-gateway -it busybox sh -c 'echo asd | nc host.docker.internal 8080 && echo "success" || echo "failed"'
  3. docker run --rm --add-host=host.docker.internal:host-gateway -it busybox sh -c 'echo asd | nc 192.168.5.2 8080 && echo "success" || echo "failed"'

For instance:

On one terminal:

$ nc -l 8080

On another:

$ docker run --rm --add-host=host.docker.internal:host-gateway -it busybox sh -c 'echo asd | nc host.docker.internal 8080 && echo "success" || echo "failed"'
failed

$ docker run --rm --add-host=host.docker.internal:host-gateway -it busybox sh -c 'echo asd | nc 192.168.5.2 8080 && echo "success" || echo "failed"'
success

Expected behaviour

Connecting via host.docker.internal should work as it used to on <=0.6.2

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0