abiosoft / colima

Container runtimes on macOS (and Linux) with minimal setup
MIT License
19.31k stars 388 forks source link

colima template has no effect #704

Open froemken opened 1 year ago

froemken commented 1 year ago

Description

Hello,

I'm very new to colima and I'm sure I have tried colima 6 or 8 month ago. So first of all colima delete to start a fresh setup. I found a colima template command. Nice. I have edited the default template to my needs on a Mac M1...you know, with "vz", "virtiofs", ...

As I have editited the default template I thought just colima start should done the job, but after colima status I see colima is still working on QEMU. Sorry, don't understand that. Further I have tried colima start -e to see the current configuration. Nearly all values are empty and have nothing to do with my default template values. I also tried colima start -p default, but the result keeps the same.

Maybe I have miss-understood the meaning of colima template.

Can you please explain the usage of colima template to me or do I have found a bug?

Nice greetings

Stefan

Version

Colima Version: 0.5.4 Lima Version: 0.15.1 Qemu Version: 8.0.0

Operating System

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/froemken/.colima/default/docker.sock

Reproduction Steps

  1. colima delete
  2. colima template
  3. modify values to my needs for a Mac M1: vz, virtioFS, ...
  4. colima start

Expected behaviour

After modifying the default values with colima template I expect colima start will use the defaults from template while start up.

Additional context

docker context is set correctly:

➜  ~ docker context ls
NAME            DESCRIPTION                               DOCKER ENDPOINT                                      ERROR
colima *        colima                                    unix:///Users/froemken/.colima/default/docker.sock   
default         Current DOCKER_HOST based configuration   unix:///var/run/docker.sock                          
desktop-linux     
froemken commented 1 year ago

I have colima delete everything again. Than I have copied over the ~/.colima/_templates/default.yaml with the version from my backup with 2 CPU, 4 GB and 60 GB Disk and of course vz, virtiofs.

After colima start I see folling in limactl list:

➜  ~ limactl list
NAME      STATUS     SSH                CPUS    MEMORY    DISK
colima    Running    127.0.0.1:50829    4       4GiB      100GiB

It has nothing to do with my presets.

Next check:

➜  ~ qemu-img info ~/.lima/colima/diffdisk         
image: /Users/froemken/.lima/colima/diffdisk
file format: qcow2
virtual size: 100 GiB (107374182400 bytes)
disk size: 200 MiB
cluster_size: 65536
Format specific information:
    compat: 1.1
    compression type: zlib
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
    extended l2: false
Child node '/file':
    filename: /Users/froemken/.lima/colima/diffdisk
    protocol type: file
    file length: 199 MiB (208404480 bytes)
    disk size: 200 MiB

I wonder about qcow2? I remember an error message that colima expects format: raw.

Here is my default.yaml:

disk: 60
memory: 4
arch: host
runtime: docker
kubernetes:
  enabled: false
  version: v1.24.3+k3s1
  disable:
    - traefik

autoActivate: true
network:
  address: false
  dns:
    - 8.8.8.8

  dnsHosts:
    host.docker.internal: host.lima.internal

  driver: gvproxy

forwardAgent: false
docker: {}
vmType: vz
rosetta: true
mountType: virtiofs
cpuType: host
layer: false
provision: []
sshConfig: true
mounts: []
env: {}
froemken commented 1 year ago

I now have started colima completely manually:

colima start -c 2 -d 60 -n 8.8.8.8 -m 4 --mount-type virtiofs --vm-type vz --vz-rosetta

and now it seems correct:

➜  ~ qemu-img info ~/.lima/colima/diffdisk
image: /Users/froemken/.lima/colima/diffdisk
file format: raw
virtual size: 60 GiB (64424509440 bytes)
disk size: 181 MiB
Child node '/file':
    filename: /Users/froemken/.lima/colima/diffdisk
    protocol type: file
    file length: 60 GiB (64424509440 bytes)
    disk size: 181 MiB
➜  ~ limactl list  
NAME      STATUS     SSH                CPUS    MEMORY    DISK
colima    Running    127.0.0.1:51088    2       4GiB      60GiB
abiosoft commented 1 year ago

Thanks for reporting, something is definitely off.

Yeah, if you set values in the template it is meant to be used as the default values for new instances.

Any idea if you get same behaviour by deleting the template file ~/.colima/_templates/default.yaml before running colima template?

froemken commented 1 year ago

Hello @abiosoft

no chance. It does not work. I have colima delete everything and removed the template file. Then starting from the very beginning with colima template. I've set CPU: 2, RAM: 4 GB and Disk: 60 GB and of course all the Apple M1 specific settings. But it's still:

➜  ~ limactl list  
NAME      STATUS     SSH                VMTYPE    ARCH       CPUS    MEMORY    DISK      DIR
colima    Running    127.0.0.1:53628    qemu      aarch64    4       4GiB      100GiB    ~/.lima/colima

I have not configured 4 CPUs! and 100 GB is also wrong.

Have a cool start into the upcoming week ;-)

Stefan

abiosoft commented 1 year ago

Thanks, then it is likely a bug if that is the case.

TheSagab commented 1 year ago

Hello, I have the same issue when starting with colima start --edit, just like @froemken. I've also tried with the following command:

colima start -c 4 -m 8 --mount-type virtiofs --vm-type vz

INFO[0000] starting colima
INFO[0000] runtime: docker
INFO[0000] creating and starting ...                     context=vm
> Terminal is not available, proceeding without opening an editor
> `mountType: 9p` is experimental
> `vmType: vz` is experimental
> field `mountType` must be "reverse-sshfs" or "virtiofs" for VZ driver , got "9p"
FATA[0000] error starting vm: error at 'creating and starting': exit status 1

It seems to ignore the --mount-type flag when the value is virtiofs. When I tried using reverse-sshfs, it gives the following error:

colima start -c 4 -m 8 --mount-type reverse-sshfs --vm-type vz

FATA[0000] error in config: invalid mountType: 'reverse-sshfs'

And when I'm not passing any --mount-type flag, I got the following error:

colima start -c 4 -m 8 --vm-type vz

INFO[0000] starting colima
INFO[0000] runtime: docker
INFO[0000] creating and starting ...                     context=vm
> Terminal is not available, proceeding without opening an editor
> `mountType: 9p` is experimental
> `vmType: vz` is experimental
> field `mountType` must be "reverse-sshfs" or "virtiofs" for VZ driver , got "9p"
FATA[0000] error starting vm: error at 'creating and starting': exit status 1

I am using Mac M2 with version 13.0.1 and same Colima version as above.

rxynrg commented 1 year ago

Hello @abiosoft

Hello, is it appropriate to suggest here to add a convenient way to run a program with a certain config? This would be more flexible than the default template and the --edit option. Like colima start --config vm.yaml

Thank you for your work

ryancurrah commented 1 year ago

Seems from people in our company that this issue only happens if they have or had rancher desktop installed. No sure why though

taos-will commented 1 year ago

Any workaround here?

allthingsclowd commented 1 year ago

Any workaround here?

I deleted BOTH my ~/.colima/ AND ~/.lima directories as the mountType appeared to be coming from an overrides.yml file in the ~/.lima directory.

then restarted colima at it all came up.