abiosoft / colima

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

Cannot connect to localhost:<exposed_port> after fresh install #1064

Open zhibirc opened 4 months ago

zhibirc commented 4 months ago

Description

Install Colima in according to repo's README.

Use docker compose, all required containers are run successfully.

Using colima start --network-address doesn't help.

Could you please provide me (it may be useful to describe it comprehensively in documentation as well) with the guidance how to enable access from host machine as mentioned? Thanks in advance!

Version

colima version 0.6.9
git commit: c3a31ed05f5fab8b2cdbae835198e8fb1717fd0f

runtime: docker
arch: aarch64
client: v27.0.3
server: v26.1.1
limactl version 0.22.0
qemu-img version 9.0.1
Copyright (c) 2003-2024 Fabrice Bellard and the QEMU Project developers

Operating System

Output of colima status

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

Reproduction Steps

docker compose up

Expected behaviour

Access my container by http://localhost:<port>

Additional context

No response

mikko-ahonen commented 4 months ago

I am having the same issue

abiosoft commented 4 months ago

That is strange. Can you share your docker compose file?

zhibirc commented 3 months ago

Thank you very much for your answer!

Updates:

Run colima as: colima start --cpu 4 --memory 8 --vm-type=vz --vz-rosetta --network-address It starts successfully and works nicely. colima status shows:

INFO[0005] colima is running using macOS Virtualization.Framework
INFO[0005] arch: aarch64
INFO[0005] runtime: docker
INFO[0005] mountType: virtiofs
INFO[0005] address: 192.168.107.2
INFO[0005] socket: unix:///Users/<username>/.colima/default/docker.sock

Connection to 192.168.107.2 is ok, let's say http://192.168.107.2:9000/api/resource works, but http://localhost:9000/api/resource doesn't.

It's not related to the Docker Compose setup, eventually, I discovered the same issue even I run just one container using docker run ....

I tried 127.0.0.1, it doesn't immediately failed due to socket hang up, but connection still not working. Result from curl -v http://127.0.0.1:9000/api/resource

*   Trying 127.0.0.1:9000...
* Connected to 127.0.0.1 (127.0.0.1) port 9000
> GET /api/resource HTTP/1.1
> Host: 127.0.0.1:9000
> User-Agent: curl/8.6.0
> Accept: */*
>
< HTTP/1.1 200 Connection Established
* no chunk, no close, no size. Assume close to signal end
<
timozerrer commented 3 months ago

Confirm, same issue on a fresh install Apple Silicon >= 14 (Sonoma)

hylin0524 commented 2 weeks ago

I face the same issue with v0.7.6. And I upgraded to v0.8.0 the problem resolved now. Apple Silicon M3