Javascript is required

Sep 28, 2021

Replace Docker Desktop with Multipass

Replace Docker Desktop with Multipass


Because Docker Desktop is taking a lot of resource from my Mac.

Getting Started

The follwing steps have been tested on my Intel Macbook w/ 16gb ram.

You will needs to remove Docker Desktop before started this tutorial.

Install Multipass & Docker

Multipass is a cli tools that can let you create and running Ubuntu VM in a minutes.

Require Homebrew installed

brew install multipass docker

Test install

multipass version

multipass  1.7.0+mac
multipassd 1.7.0+mac

Create Multipass VM

First, create a VM config file docker.yaml

  - name: ubuntu
      - your-ssh-public-key
package_uplang: zh-TW
date: true
  - docker
  - avahi-daemon
  - apt-transport-https
  - ca-certificates
  - curl
  - gnupg
  - lsb-release
  - sudo curl -fsSL | sudo bash
  - sudo systemctl enable docker
  - sudo systemctl enable -s HUP ssh
  - sudo groupadd docker
  - sudo usermod -aG docker ubuntu

Then run this command to create a Ubuntu VM

multipass launch -c 2 -m 1G -d 5G -n docker 20.10 --cloud-init docker.yaml

This will take a few mins to build and start. Once it's done you can see what is running with

multipass list

Connect to VM

SSH into docker VM

ssh ubuntu@docker.local

Makesure you accepted VM to save you SSH key, this is required for docker to auto connect to remote docker engian.

Also check is docker installed on VM by running

docker info

Setup docker host

Add this to your ~/.zprofile to always use this DOCKER_HOST

export DOCKER_HOST="ssh://ubuntu@docker.local"

Apply changes

source ~/.zprofile

Check docker info

docker info