Macs with M1 chips run Docker with Colima

Original link: https://jasonkayzk.github.io/2023/03/17/M1%E8%8A%AF%E7%89%87%E7%9A%84Mac%E4%BD%BF%E7%94%A8Colima %E8%BF%90%E8%A1%8CDocker/

random?41

Docker provides DockerDesktop with a panel on the Mac with the M1 chip, which feels like a waste of performance. I still prefer the command line;

You can use Colima to run Docker;

source code:

Macs with M1 chips run Docker with Colima

Install

Colima is dedicated to building a container environment on MacOS;

Colima installation is very simple:

 brew install colima

At the same time, Colima depends on the container environment, such as: Docker, Containerd;

Install Docker:

 # Docker# You can use the docker client on macOS after colima start with no additional setup.brew install docker

start up

Start the Colima backend with the following command:

 ~ colima startINFO[0000] starting colimaINFO[0000] runtime: dockerINFO[0000] preparing network ... context=vmINFO[0000] starting ... context=vmINFO[0051] provisioning ... context=dockerINFO[0051] starting ... context=dockerINFO[0057] done

Colima will use the QEMU virtual machine;

Arguments can also be specified at startup:

 colima start --cpu 1 --memory 2 --disk 10colima start --arch aarch64 --vm-type=vz --vz-rosetta...

You can also edit the configuration and use the configuration to start:

 colima start --edit

Once Colima is started, Docker commands are ready to use!

For example, to open a Portainer panel:

 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

stop

Stopping Docker just needs to stop the Colima virtual machine:

 colima stop

It is very simple to use;

configuration

There are some configurations that must be modified, such as:

 # 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

appendix

source code:

This article is reproduced from: https://jasonkayzk.github.io/2023/03/17/M1%E8%8A%AF%E7%89%87%E7%9A%84Mac%E4%BD%BF%E7%94%A8Colima %E8%BF%90%E8%A1%8CDocker/
This site is only for collection, and the copyright belongs to the original author.