colima: option --network-address does not expose internal ip address

Description

Starting colima with --network-address, or setting address: true in the config file, does not expose internal IP address of the docker host. colima list outputs an empty value for the ADDRESS column:

➜  ~ colima list
PROFILE    STATUS     ARCH       CPUS    MEMORY    DISK      RUNTIME    ADDRESS
default    Running    aarch64    4       4GiB      100GiB    docker

Version

Colima Version: 0.4.6 Lima Version: 0.12.0 Qemu Version: Stable 7.1.0

Operating System

  • macOS Intel
  • macOS M1
  • Linux

Reproduction Steps

  1. colima start --network-address
  2. <wait until colima started>
  3. colima list. The address field is empty

Expected behaviour

colima list should apparently show an ip address that can be used to access anything listening within the docker container

Additional context

No response

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 12
  • Comments: 53 (8 by maintainers)

Most upvoted comments

Hi, I have similar problem:

  • MacOS: 14.2.1 (23C71)
  • Chip: Apple M3 Pro
  • Colima version: 0.6.7

I’ve tried starting colima with:

colima start --arch x86_64 --vm-type=vz --memory 4 --network-address

but my ADDRESS column is empty. colima ls output: image

Any advice what am I missing?

Hello I share with you a shell script to fix this issue and manually expose the IP. Please let me know if it works for you.

#!/bin/zsh

# Connect via ssh
colima ssh << EOF
# Switch to superuser
sudo su -
sudo ip addr add 192.168.106.2/24 dev col0
sudo ip link set col0 up
sudo ip route add default via 192.168.106.1
sudo ip link set col0 down
sudo ip link set col0 up
ip addr show col0
ip route show
EOF

Try downgrading the colima version from 0.6.7 to 0.6.6, that worked for me on Apple M3 Pro

$ brew uninstall colima
$ sudo curl -L -o /usr/local/bin/colima https://github.com/abiosoft/colima/releases/download/v0.6.6/colima-Darwin-arm64 && sudo chmod +x /usr/local/bin/colima
$ colima start -c 4 -m 8 -a x86_64 --disk 200 --network-address

image

That’s strange. If you upgraded from a version < 0.4.0, you should colima delete and start afresh.

Can you stop colima and clear the following files, then try again?

colima stop
sudo rm -rf /etc/sudoers.d/colima /opt/colima
colima start --network-address

If it still fails, kindly run with --very-verbose flag and share the output.

Thanks.

Hello I share with you a shell script to fix this issue and manually expose the IP. Please let me know if it works for you.

#!/bin/zsh

# Connect via ssh
colima ssh << EOF
# Switch to superuser
sudo su -
sudo ip addr add 192.168.106.2/24 dev col0
sudo ip link set col0 up
sudo ip route add default via 192.168.106.1
sudo ip link set col0 down
sudo ip link set col0 up
ip addr show col0
ip route show
EOF

Got Cannot find device "col0" When typing ip addr on the vm I see the following devices

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 52:55:55:de:82:57 brd ff:ff:ff:ff:ff:ff
    inet 192.168.5.1/24 metric 100 brd 192.168.5.255 scope global dynamic eth0
       valid_lft 3427sec preferred_lft 3427sec
    inet6 fe80::5055:55ff:fede:8257/64 scope link
       valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
    link/ether 02:42:42:f6:83:7c brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever

My mac: M3 chip, Sonoma 14.3.1 (23D60)

MacOS Sonoma Colima 0.5.5

finally got it worked by deleting the existing colima.

colima delete -- careful with this command, this will wiped out all of your data(containers, image, volume, etc) make sure you already backup
colima start --arch aarch64 --vm-type=vz --vz-rosetta --network-address

most probably, i did create the colima without specify the --arch and --vm-type thus it’s failing to retrieve the ip address of the docker host on Mac.

This worked for me after a reboot.

MacOS Sonoma Colima 0.5.5

finally got it worked by deleting the existing colima.

colima delete -- careful with this command, this will wiped out all of your data(containers, image, volume, etc) make sure you already backup
colima start --arch aarch64 --vm-type=vz --vz-rosetta --network-address

most probably, i did create the colima without specify the --arch and --vm-type thus it’s failing to retrieve the ip address of the docker host on Mac.

Can you try with --network-driver slirp?

colima start --network-address --network-driver slirp

I encountered this suddenly on macOS 14 with the system firewall enabled.

Disabling the system firewall, while a somewhat radical solution that needs to be considered well, helped.

Oddly, it used to work with the system firewall being enabled. The only conscious change in the last days was installing and using the AWS Client VPN. I wonder if that maybe messed with things… VPN was disabled while I tried colima, by the way.

I wonder if there is any program I could whitelist in the firewall settings?

Update: Whitelisting bootpd as per https://github.com/abiosoft/colima/issues/449#issuecomment-1989842823 did the trick. Still not sure why it suddenly stopped working…

@RobertoMD : See if specifying a specific firewall rule for bootpd so the VM is allowed to get an IPv4 address via DHCP helps: https://github.com/abiosoft/colima/issues/458#issuecomment-1989839779

Hello I share with you a shell script to fix this issue and manually expose the IP. Please let me know if it works for you.

#!/bin/zsh

# Connect via ssh
colima ssh << EOF
# Switch to superuser
sudo su -
sudo ip addr add 192.168.106.2/24 dev col0
sudo ip link set col0 up
sudo ip route add default via 192.168.106.1
sudo ip link set col0 down
sudo ip link set col0 up
ip addr show col0
ip route show
EOF

This is working for me… thanks @afettahghazi

MacOS Sonoma (M1) Colima 0.5.6

@afganhalbana so i had colima working, then i upgraded my mac to Sonoma and then colima isnt working. I have tried your suggestion above and it is still not working

I had the same issue, but while using the vz vm-type. Was able to resolve the issue with rebooting MacOS.

@abiosoft , It DOES work with the --network-driver slirp option. I’ll use this option from now on. Thanks!

~ colima list
PROFILE    STATUS     ARCH       CPUS    MEMORY    DISK      RUNTIME    ADDRESS
default    Running    aarch64    4       4GiB      100GiB    docker     192.168.106.2