Mac使用Colima运行Docker
Container runtimes on macOS (and Linux) with minimal setup
Installation
1
2
|
# Homebrew
brew install colima
|
安装Docker
启动
Colima 会使用 QEMU 虚拟机;
启动时指定参数
create VM with 1CPU, 2GiB memory and 10GiB storage.
1
|
colima start --cpu 1 --memory 2 --disk 10
|
create VM with Rosetta 2 emulation. Requires v0.5.3 and MacOS >= 13 (Ventura)
1
|
colima start --arch aarch64 --vm-type=vz --vz-rosetta
|
使用配置启动
启动成功后,使用docker运行一个Portainer面板:
1
|
docker run -d -p 18000:8000 -p 19443:9443 -p 19000:9000 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
|
starts and setup Containerd
1
|
colima start --runtime containerd
|
starts and setup Kubernetes
1
2
3
|
brew install kubectl
colima start --kubernetes
|
配置
修改配置,如下:
1
2
3
4
5
6
7
8
9
|
# Number of CPUs to be allocated to the virtual machine.
cpu: 2
# Size of the disk in GiB to be allocated to the virtual machine.
# NOTE: changing this has no effect after the virtual machine has been created.
disk: 60
# Size of the memory in GiB to be allocated to the virtual machine.
memory: 2
|
停止
停止 Docker 只需要停止 Colima 虚拟机即可:
参考