Hello everyone. Is my first time with colima, and I have problems access the containers using localhost:<port>. Anyone can help me?
Hello everyone. Is my first time with colima, and I have problems access the containers using localhost:<port>. Anyone can help me?
Originally posted by @tutods in https://github.com/abiosoft/colima/discussions/421
I'm wondering the same thing. I have started a postgres and a pgadmin with docker compose. I have made pgadmin accessable with port forwading. Then i added a entry in my hosts file, pointing localhost against the network address and now im trying to access the port exposed from chrome. Unfortunatly i'm getting network refused and can't figure out where i went wrong. Any help much appreciated!
Then i added a entry in my hosts file, pointing localhost against the network address and now im trying to access the port exposed from chrome
Can you elaborate on this?
Also, localhost is fixed and should not be pointed to any other address outside of the default 127.0.0.1.
Gladly :) So I have a docker-compose file. There, I start a postgres image and a pgadmin image. The pgadmin image should be accessible on port 5050.
in compose you can acchieve this by setting:
ports: - 5050:5050
Or something like that. The containers and the apps starts as expected. But when I try to access pgadmin from chrome, I just get connection refused. I am probably missing something stupid.
Also, I’m starting Colima with —network-address flag. That was why I thought I should create an entry in my hosts file, on my Mac, not in the VM, pointing to local host. That’s how Docker desktop did it :)
192.168.0.2 localhost
where the ip is the one I got from Colima status
You do not need to have --network-address enabled to have port 5050 reachable. And chrome should be able to access http://localhost:5050.
And if network address is enabled, you should also be able to access via http://<ip>:5050 e.g. http://192.168.106.2:5050.
That was what I thought 😅 so, either it’s something wrong with the image, or maybe I forgot to set something up. Or, my computer is having a bad day. I will let you know as soon as I find out. Thanks for a quick response!
Ok, I was stupid and didn’t read the pgadmin image instruction carefully enough. Everything works as you said! Sorry for wasting you time!
What did you do? I am trying to switch from Docker Desktop and localhost stopped working - only 127.0.0.1.
Same question here. I have the exact same problem, colima is fine running my docker images, the ports are open according to docker, but I cannot reach them.
❯ docker port b4cf984adcf0
2181/tcp -> 0.0.0.0:22181
2181/tcp -> [::]:22181
❯ nc -zv localhost 22181
nc: connectx to localhost port 22181 (tcp) failed: Connection refused
nc: connectx to localhost port 22181 (tcp) failed: Connection refused
I found several other people with these problems here, but all tickets got closed without any valid answer on what the root cause is and how to make it work!
This issue is also intermittent/random. For me the port is not accessible from the host(mac) for most of the times, but randomly like 1 in 10 times, the port is open for the host machine and I can reach the docker container from the host.
I am having the very same issue. I have created a new container with Oracle exposing the Listener port, and there is no way I can access the port from the Mac host. I've restarted colima with this --network-address option and it didn't help. From the colima VM (colima ssh) I can telnet to the Listener port inside the container, but whenever I try from the Mac host I get "no Listener" because I cannot reach out to its port. Any help woul be appretiated.
I am also facing the similar issue. Could you help me how to resolve as i do not found solution in this ticker still marked as closed.
Can you share the docker image(s) that you are trying to run?
Can you share the docker image(s) that you are trying to run?
@abiosoft I am trying to run testcontainers/ryuk:0.8.1 docker image. when i ran docker ps I can see container started but not able to connect it via exposed port on host.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 95bd356102ae testcontainers/ryuk:0.8.1 "/bin/ryuk" 34 seconds ago Up 33 seconds 0.0.0.0:32768->8080/tcp, :::32768->8080/tcp testcontainers-ryuk-34360383-d799-4795-9d46-23724eaa7a08
I tried using --network-address and use both localhost or 192.168.106.2 it is not able to connect on port 32768.
An error example is :
org.testcontainers.utility.RyukResourceReaper - Can not connect to Ryuk at 192.168.106.2:59066 java.net.SocketTimeoutException: Connect timed out
Can you share the docker image(s) that you are trying to run?
@abiosoft I am trying to run testcontainers/ryuk:0.8.1 docker image. when i ran
docker psI can see container started but not able to connect it via exposed port on host.CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 95bd356102ae testcontainers/ryuk:0.8.1 "/bin/ryuk" 34 seconds ago Up 33 seconds 0.0.0.0:32768->8080/tcp, :::32768->8080/tcp testcontainers-ryuk-34360383-d799-4795-9d46-23724eaa7a08
I tried using
--network-addressand use both localhost or 192.168.106.2 it is not able to connect on port 32768.An error example is :
org.testcontainers.utility.RyukResourceReaper - Can not connect to Ryuk at 192.168.106.2:59066 java.net.SocketTimeoutException: Connect timed out
I can see there is an open ticket https://github.com/abiosoft/colima/issues/999 for the same.
@ravi-Mode are you using testcontainers in a project? Can you share the steps for me to reproduce your scenario?
I do remember that testcontainers may require that you bind the default docker socket which is usually done with
sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock
Try settings theese two ENV variables
TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=/var/run/docker.sock
TESTCONTAINERS_HOST_OVERRIDE=<your-ip>
@ravi-Mode
Hi @abiosoft , @gotpist1 I am using testcontainer for testing purpose. I have added these profile in ENV variable. If i don't use it then it is not pulling image itself. After adding the ENV it is able to pull image but not able to connect to exposed port on host machine.