colima icon indicating copy to clipboard operation
colima copied to clipboard

Think about making it more explicit for users coming from Linux background

Open B1Z0N opened this issue 2 years ago • 11 comments

Description

I've spent a lot of time to understand that to make it work with ports I need to run:

colima start --network-address   # to enable ports visibility
colima list    # to see the vm host ip

I understand that it's partially my fault. But there's also a capacity to make a tool more intuitive and save lots of time as humanity has other things to do right now.

I suggest we make it to display huge red banner saying something like that

.-----------------------------------------------------------------------------.
| Please be aware that you'll need to access this IP _________, not locahost! |
'-----------------------------------------------------------------------------'

And if it's not being run with --network-address, I suggest displaying:

.-------------------------------------------------------------------------------------------------.
| Attention! Ports are not visible from your PC!. Use "colima start --network-address" to enable. |
'-------------------------------------------------------------------------------------------------'

B1Z0N avatar Jan 03 '23 17:01 B1Z0N

P.S. at least take a time to think about it.

B1Z0N avatar Jan 03 '23 17:01 B1Z0N

That's weird because I don't use the --network-address flag and I can access my containers just fine, both from my local network and from outside. To be honest I'm not 100% certain what the use case for this flag is in the first place. 🤔

fskaeh avatar Jan 03 '23 18:01 fskaeh

@B1Z0N what do you mean by ports not visible on localhost? Because it is.

In fact, network address was only added later due to user requests. And from v0.5.0, colima status displays the IP address as well (if enabled).

abiosoft avatar Jan 03 '23 18:01 abiosoft

I mean that I wasn't able to access the 5000 port of my docker container on 127.0.0.1:5000 as in linux. I've needed to check colima list and enable it with colima start --network-address. And then access {some_colima_ip}:5000.

B1Z0N avatar Jan 03 '23 18:01 B1Z0N

So if it works without --network-address that's cool! Then just the second part: in my opinion it is important to make people aware that it's not on the 127.0.0.1 or 0.0.0.0 or localhost.

B1Z0N avatar Jan 03 '23 18:01 B1Z0N

I mean that I wasn't able to access the 5000 port of my docker container on 127.0.0.1:5000 as in linux. I've needed to check colima list and enable it with colima start --network-address. And then access {some_colima_ip}:5000.

macOS Ventura now utilises port 5000 by default so it is recommended to use another port. That is most likely your issue.

$ lsof -nP -iTCP:"5000" | grep LISTEN
ControlCe 573 abiola    7u  IPv4 0x3978c0b139c0be1f      0t0  TCP *:5000 (LISTEN)
ControlCe 573 abiola    8u  IPv6 0x3978c0ac6d519127      0t0  TCP *:5000 (LISTEN)

abiosoft avatar Jan 03 '23 18:01 abiosoft

So if it works without --network-address that's cool! Then just the second part: in my opinion it is important to make people aware that it's not on the 127.0.0.1 or 0.0.0.0 or localhost.

It should work. As I mentioned I don't use that flag at all and I can still reach my containers at localhost/0.0.0.0:

$ curl 0.0.0.0:443

<html>
<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<center>The plain HTTP request was sent to HTTPS port</center>
<hr><center>nginx</center>
</body>
</html>

fskaeh avatar Jan 03 '23 18:01 fskaeh

I wonder if the confusion here has to do with IPv6. I just switched from Docker Desktop to Colina and noticed that pg (a popular nodejs postgres client) would no longer connect to localhost:5432 successfully but 127.0.0.1:5432 kept working. I noticed in the logs that said client uses IPv6 ::1 by default but does not fall back to IPv4 127.0.0.1. A quick test with telnet confirms that ::1 does not work while 127.0.0.1 does:

% telnet localhost 5432
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'

and 0.0.0.0 is also working

% telnet 0.0.0 5432
Trying 0.0.0.0...
Connected to 0.0.0.
Escape character is '^]'.

FabianFrank avatar Jan 14 '23 23:01 FabianFrank

I ran into this exact same issue. This is unfortunately causing me to switch back to Docker Desktop. I am using node 18 on OS X Ventura 13.1, and the pg client resolves localhost to ::1 which Colima cannot handle. I believe this is because node 18 does enforce IPv4 resolution first anymore, and Colima cannot handle a IPv6 address. But Docker Desktop handles it just fine. Any chances of getting this addressed?

ujwal-setlur avatar Jan 15 '23 03:01 ujwal-setlur

Running into the same issue as @ujwal-setlur: request to http://localhost:49153 failed, reason: connect ECONNREFUSED ::1:49153

cristianrgreco avatar Mar 12 '23 21:03 cristianrgreco

How one can dig deeper into your reports without even knowing which colima version it is, or what's the OS? Also, a sample dockerfile could be beneficial in attempt to reproduce this issue

avoidik avatar Feb 25 '24 06:02 avoidik