colima icon indicating copy to clipboard operation
colima copied to clipboard

Problem with port binding

Open julian-ladjani opened this issue 1 year ago • 2 comments

Description

Hello, I use colima since yesterday, I have a dns container working perfectly with docker, since I use colima, Ihave this problem: docker: Error response from daemon: driver failed programming external connectivity on endpoint nice_bell (b688f5012ab945b7d85e4f85a1ead26960501561deb75c417db4333e27b85db7): failed to bind port 0.0.0.0:53/tcp: Error starting userland proxy: listen tcp4 0.0.0.0:53: bind: address already in use. (same with udp), When I use 54 port (for exemple), it work fine. Maybe it's a permissions problem or something like that?

Version

colima version 0.7.5 git commit: 1588c066b9ab9dae8205ef265929c7eb43dca473

runtime: docker arch: aarch64 client: v27.2.1 server: v27.1.1 limactl version 0.23.2 qemu-img version 9.1.0

Operating System

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

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] socket: unix:///Users/julian/.colima/default/docker.sock

Reproduction Steps

  1. docker run -p 53:53 -it --rm alpine ash

Expected behaviour

same as docker run -p 54:54 -it --rm alpine ash

Additional context

No response

julian-ladjani avatar Sep 19 '24 08:09 julian-ladjani

It simply means something is already using port 53.

You can check the program using it by running the following command.

lsof -nP -iTCP:53 | grep LISTEN

abiosoft avatar Sep 19 '24 09:09 abiosoft

I tested with netcat before in addition to lsof (by listening to port 53 directly). Since we did not find a solution, we installed a dnsmasq and it works perfectly but not with docker-compose with colima (works with docker desktop).

I tried with two macs, it gives the same result

julian-ladjani avatar Sep 22 '24 13:09 julian-ladjani

I'm installing pihole and get stuck too. finally figured out the port 53 usage, you have to colima ssh into runtime inside to run lsof -nP -iTCP:53 | grep LISTEN

tcp   LISTEN 0      4096         127.0.0.54:53        0.0.0.0:*    users:(("systemd-resolve",pid=227,fd=17))
tcp   LISTEN 0      4096      127.0.0.53%lo:53        0.0.0.0:*    users:(("systemd-resolve",pid=227,fd=15))

it's explained in pihole. https://github.com/pi-hole/docker-pi-hole?tab=readme-ov-file#installing-on-ubuntu-or-fedora

c3qo avatar Nov 13 '24 16:11 c3qo