You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need a colima machine to have its own IP so I can reach exposed ports from the host. I am using --network-address for that.
I want to map this IP to a custom domain name. I can easily do that by adding an entry to /etc/hosts on my host machine. I wrote a small script to automatically detect the IP addres used by colima and update /etc/hosts as needed (using colima status --json | jq -r .ip_address and comparing with the output of dscacheutil). So far so good.
Now, I also need this custom domain name to be resolvable to the same IP within docker containers on the colima machine, and this is where I'm a little frustrated.
The networking stack inside the colima VM does not seem to pick up the change to /etc/hosts on the macOS host. I can make edits to /etc/hosts on the VM but those are not picked up by docker containers.
I very much do not want to have to manually pass extra host entries to every container I start, and have to update those if the IP ever changed upon a VM restart.
As far as I can tell, the only way to achieve my goal is to follow this sequence:
and hope the IP of the machine will not change on restart (is that a safe assumption? I have no idea...)
In general, I would like to have a way to update DNS config without stopping the machine. Ideally, it would be nice if the internal resolver for the bridge interface honored the hosts' /etc/hosts by default.
As a special case, for a short-term workaround, I would be okay if the auto-assigned machine IP was resolved to a fixed domain by the internal DNS, so I can easily alias my custom name to that immediately when first creating the machine.
The text was updated successfully, but these errors were encountered:
and hope the IP of the machine will not change on restart (is that a safe assumption? I have no idea...)
It is a safe assumption. The IP address is generated using the mac address of the virtual network interface. As long as the VM has not been destroyed and re-created, the IP address would remain.
The networking stack inside the colima VM does not seem to pick up the change to /etc/hosts on the macOS host. I can make edits to /etc/hosts on the VM but those are not picked up by docker containers.
I actually assume that this should work, probably a bug.
The docker containers can definitely reach the VM via the (fixed) IP address. Maybe it makes sense to add (as an in-built feature) a dns entry that resolves to the VM's IP address. Considring the macOS host is available via host.docker.internal.
Description
I need a colima machine to have its own IP so I can reach exposed ports from the host. I am using
--network-address
for that.I want to map this IP to a custom domain name. I can easily do that by adding an entry to
/etc/hosts
on my host machine. I wrote a small script to automatically detect the IP addres used by colima and update/etc/hosts
as needed (usingcolima status --json | jq -r .ip_address
and comparing with the output ofdscacheutil
). So far so good.Now, I also need this custom domain name to be resolvable to the same IP within docker containers on the colima machine, and this is where I'm a little frustrated.
The networking stack inside the colima VM does not seem to pick up the change to
/etc/hosts
on the macOS host. I can make edits to/etc/hosts
on the VM but those are not picked up by docker containers.I very much do not want to have to manually pass extra host entries to every container I start, and have to update those if the IP ever changed upon a VM restart.
As far as I can tell, the only way to achieve my goal is to follow this sequence:
and hope the IP of the machine will not change on restart (is that a safe assumption? I have no idea...)
In general, I would like to have a way to update DNS config without stopping the machine. Ideally, it would be nice if the internal resolver for the bridge interface honored the hosts'
/etc/hosts
by default.As a special case, for a short-term workaround, I would be okay if the auto-assigned machine IP was resolved to a fixed domain by the internal DNS, so I can easily alias my custom name to that immediately when first creating the machine.
The text was updated successfully, but these errors were encountered: