colima: Slow image pulling when using VZ VM type
Description
Pulling images is very slow when I set the VM type to VZ.
On the docker hello world image, running it from a clean colima instances takes 3 seconds using the default parameters, and 17 seconds when --vm-type=vz
is set. It looks like the time is spent initiating the connection because the download speed looks fine. Could be a slow DNS query, a slow TCP handshake, a slow TLS handshake, I don’t know.
Version
Colima Version: 0.5.4
Lima Version: 0.15.0
Qemu Version: 7.2.0
Operating System
macOS M1 >= 13 (Ventura)
Output of colima status
INFO[0000] colima is running using macOS Virtualization.Framework
INFO[0000] arch: aarch64
INFO[0000] runtime: docker
INFO[0000] mountType: virtiofs
INFO[0000] socket: unix:///Users/fungiboletus/.colima/default/docker.sock
Reproduction Steps
colima start --cpu 4 --memory 4
time docker run -it --rm hello-world
colima delete
colima start --cpu 4 --memory 4 --vm-type=vz
time docker run -it --rm hello-world
colima delete
Expected behaviour
The duration of pulling and running the hello-world image should be similar.
Additional context
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 6
- Comments: 21 (4 by maintainers)
Maybe we could have IPv6 disabled by default, as is tradition.
I have done some tests and I think it might be related to DNS and IPv6, with default dns setting of
[]
in the yaml configuration, which from I gather can be forced on startup using:when using ping:
requires over 1 second for just one ping command to finish executing (takes quite long to even start9.
if forcing ping with IPv4:
it takes way about 0.2 seconds for everything to finish.
And if I do a docker pull:
if I override the default DNS with google dns:
ping without forcing IP v4:
results in basically the same response as before upon forcing IP v4.
This also matches the docker pull results:
Not sure if the issue is in colima directly or maybe lima? if the second, somebody should create an issue there, if no such issue exists.
However, specifying the correct DNS manually might not be that easy all the time as might change depending on the local/corporate network or VPN. Though I guess for the colima VM itself that might not matter - except if there is a private docker registry that is only reachable using the correct DNS server 😄
@aaronlehmann I would recommend opening a separate issue for that.
Thanks.
OK. I have done some more testing and the best solution seems to supply
--dns 192.168.5.3
on startup. This way it sets the correct default DNS and seems to force DNS requests to use IPv4 internally as the issue does not occur.Also applying dns does not seem to change the file at all after initial instance creation but it still seems to fix the slow dns resolution upon sub-sequent starts.
So e.g.: