Wiki source code of Colima
Last modified by Sebastian Marsching on 2024/10/24 12:42
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | {{toc/}} | ||
2 | |||
3 | # Getting Started | ||
4 | |||
5 | [Colima](https://github.com/abiosoft/colima) is an open-source alternative to Docker Desktop on Mac. It can easily be installed via [Homebrew](https://brew.sh/): | ||
6 | |||
7 | ```sh | ||
8 | brew install colima docker docker-compose | ||
9 | ``` | ||
10 | |||
11 | By default, a virtual machine with 2 CPUs, 2 GB of memory, and 60 GB of storage is created. This can be modified through parameters to `colima start`. | ||
12 | |||
13 | ```sh | ||
14 | colima stop | ||
15 | colima start --cpu 4 --memory 8 --disk 100 | ||
16 | ``` | ||
17 | |||
18 | One can SSH into the VM where the Docker daemon is running with the `colima ssh` command, but usually this is not necessary. Instead, one can simply use the `docker` command directly in macOS like one would when using Docker Desktop. | ||
19 | |||
20 | The home directory is automatically mounted into the VM through SSHFS, so one can use bind mounts like the following one: | ||
21 | |||
22 | ```sh | ||
23 | docker --rm -it -v $HOME/my-dir:/path-in-container image-name | ||
24 | ``` | ||
25 | |||
26 | Colima supports using Rosetta 2 for improved performance when running on ARM-based Macs: | ||
27 | |||
28 | ```sh | ||
29 | colima start --arch aarch64 --vm-type=vz --vz-rosetta | ||
30 | ``` | ||
31 | |||
32 | # Changing kernel variables with sysctl | ||
33 | |||
34 | For some applications (e.g. Elasticsearch) kernel parameters have to be changed with sysctl. In order to not have to do this manually everytime Colima is started, one can edit the Colima configuration using | ||
35 | |||
36 | ```sh | ||
37 | colima start --edit | ||
38 | ``` | ||
39 | |||
40 | Inside the editor, one can then add code that is supposed to be executed on startup. For example: | ||
41 | |||
42 | ```diff | ||
43 | - provision: [] | ||
44 | + provision: | ||
45 | + - mode: system | ||
46 | + script: sysctl -w vm.max_map_count=262144 | ||
47 | ``` | ||
48 | |||
49 | Please refer to [this GitHub issue](https://github.com/abiosoft/colima/issues/384) for details. |