abiosoft / colima

Container runtimes on macOS (and Linux) with minimal setup
MIT License
17.75k stars 365 forks source link

can't connect to localhost on osx big sur #991

Open fxlacroix opened 4 months ago

fxlacroix commented 4 months ago

Description

hello i can't access localhost after running colima and a caddy instance (as well as nginx, apache...)

Version

% colima version && limactl --version && qemu-img --version

colima version 0.6.8 git commit: 9b0809d0ed9ad3ff1e57c405f27324e6298ca04f

runtime: docker arch: x86_64 client: v20.10.17 server: v24.0.9 limactl version 0.20.1 qemu-img version 8.2.1 Copyright (c) 2003-2023 Fabrice Bellard and the QEMU Project developers

Operating System

Output of colima status

% colima status INFO[0000] colima is running using QEMU
INFO[0000] arch: x86_64
INFO[0000] runtime: docker
INFO[0000] mountType: sshfs
INFO[0000] address: 192.168.106.2
INFO[0000] socket: unix:///Users/mac/.colima/default/docker.sock

Reproduction Steps

1.% colima start --network-address

INFO[0001] starting colima
INFO[0001] runtime: docker
INFO[0002] starting ... context=vm INFO[0045] provisioning ... context=docker INFO[0046] starting ... context=docker INFO[0051] done

  1. % docker run --rm -d --name caddy -p 80:80 caddy d00639f38482e10a38a1e16ba06c488f294d76c9ac3adadf183554308fbcad43 3.% curl localhost
    curl: (7) Failed to connect to localhost port 80 after 13 ms: Couldn't connect to server mac@MacBook-Pro-de-MAC.local /Users/mac % curl 127.0.0.1 curl: (7) Failed to connect to 127.0.0.1 port 80 after 12 ms: Couldn't connect to server

Expected behaviour

i should access localhot, no other server are running. I tried the ip of the container but it s the same

Additional context

This site can’t be reachedlocalhost refused to connect. Try:

Checking the connection Checking the proxy and the firewall ERR_CONNECTION_REFUSED

fxlacroix commented 4 months ago

the wget 127.0.0.1 work when i m connecting to the container

eelcocramer commented 3 months ago

Had a similar issue, removed colima colima delete and then created it again with the following options colima start --profile default --cpu 4 --memory 8 -t vz --mount-type virtiofs which made it work again. The issue might be with the underlying VM used, i.e. -t vz

I'm on Apple Silicon btw.