M1 Mac Nerdctl Configuration
- 1 minutes read - 187 wordsConfigure nerdctl for basic containerization development on Mac ARM64.
Using nerdctl
Create an alias for the command lima nerdctl
:
alias nerd='lima nerdctl'
Writing files locally
Create a new hugo blog post file in the current project directory:
lima nerdctl run --rm -v $(pwd)/src:/src -u `id -u $USER`:`id -g $USER` \
-it elswork/rpi-hugo:latest new posts/2022-01-05-m1-mac-nerdctl.md
Configure lima
Image compatibility
To prevent the error message standard_init_linux.go:228: exec user process caused: exec format error
:
Modify the local lima configuration file: ~/.lima/default/lima.yaml
:
provision:
- mode: system
script: |
#!/bin/bash
systemctl start containerd
nerdctl run --privileged --rm tonistiigi/binfmt --install all
Restart lima:
limactl list #this lists all running vms
limactl stop default #or name of the machine
limactl start default #or name of the machine
Or issue commands manually:
limactl shell default # onto the VM again
sudo systemctl start containerd
sudo nerdctl run --privileged --rm tonistiigi/binfmt --install all
Make your development directory writeable
Modify the local lima configuration file: ~/.lima/default/lima.yaml
:
Mounts:
- location: "~/Projects"
writable: true
Restart lima:
limactl list #this lists all running vms
limactl stop default #or name of the machine
limactl start default #or name of the machine