Skip to content

CLI

Lima + Nerdctl

lima and nerdctl

  • lima and nerdctl are a replacement for Docker Desktop on MacOS
  • Useful Alias: alias d="lima nerdctl"
Install brew install lima
Start limactl start [default]
Get a shell lima
Run a container lima nerdctl run -it --rm alpine
Run docker-compose lima nerdctl compose up

Docker CLI (docker...)

General

Command Notes
ps Show running containers
images Show images
inspect <hash> Inspect container
logs <hash> Show logs
search <redis> Search images

Run

Command Notes
run --name redisHostPort -p 6379:6379 redis
run --name redisDynamic -p 6379 redis
  • -p <host>:<container> = expose port
  • -p <container> = expose on random port
run -v /opt/docket/data/redis:/data redis
  • Data Container
  • -v <host>:<container> = mount FS
run -e NODE_ENV=production ... Set environment variables
run -d redis Run in background
run ubuntu ps Run command in foreground
run -it ubuntu bash Get a shell
attach <hash> Attach a shell to a background container

Network

Command Notes
network ls List all networks on the host
network inspect <network name> Explore the network to see which containers are attached and their IP addresses
port <name> Show exposed ports

GUI

Command Notes
run -e DISPLAY=$DISPLAY
-v /tmp/.X11-unix:/tmp/.X11-unix
<container_name>
Run GUI apps (LINUX)
$ brew cask install xquartz
$ open -a XQuartz ("Allow conn from net clients")
$ IP=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')
$ xhost + $IP
$ docker run -e DISPLAY=$IP:0 -v /tmp/.X11-unix:/tmp/.X11-unix jess/firefox
Run GUI apps (MACOS)
Back to top