Skip to content

Instantly share code, notes, and snippets.

@pmbaumgartner
Last active August 13, 2025 19:50
Show Gist options
  • Save pmbaumgartner/b08a34f73afcd9b29227a42f3c042b9e to your computer and use it in GitHub Desktop.
Save pmbaumgartner/b08a34f73afcd9b29227a42f3c042b9e to your computer and use it in GitHub Desktop.

Revisions

  1. pmbaumgartner revised this gist Sep 1, 2021. 2 changed files with 33 additions and 32 deletions.
    57 changes: 28 additions & 29 deletions cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -1,29 +1,28 @@
    # Multipass Docker Setup

    This repo provides a config and instructions for getting `multipass` setup to create an Ubuntu image with docker & docker-compose for use on macOS.

    - [Download multipass](https://multipass.run/docs/installing-on-macos)
    - Update the included `cloud-init.yaml` file with your ssh key (`cat ~/.ssh/id_rsa.pub | pbcopy` should get it on your clipboard)
    - Create the multipass image with `multipass launch --cloud-init cloud-init.yaml --name docker`
    - You might need to upgrade the default settings to include more RAM/HDD space.
    - Feel free to change the `--name` argument to whatever you'd like to call this.
    - Validate correct initialization with `multipass exec docker -- docker -v && docker-compose -v`
    - Run whatever you want within the image: `multipass shell docker`. You can also just call `multipass shell` since this is the default image

    ## VSCode Use

    You can use this image with VSCode Remote to program using docker inside of the image.

    - Find the IP of the running image with `multipass list`. You're looking for something like `192.168.64.X`
    - Add this as a remote in the VSCode Remote extension
    - You will want to mount your project directory into the image with `multipass mount`. If you're in a project folder, you could do something like ```multipass mount . docker:/project/```. This is the folder you'll want to open using VSCode Remote

    ---

    **Helpful docs:**
    - [Multipass docs](https://multipass.run/docs)
    - [cloud-init examples & docs](https://cloudinit.readthedocs.io/en/latest/topics/examples.html)

    **Helpful blogs:**
    - https://aaronmsft.com/posts/multipass/
    - https://www.freshblurbs.com/blog/2020/04/19/Multipass-Docker-Mac-Cassandra.html
    #cloud-config
    package_upgrade: true

    ssh_authorized_keys:
    - <your key>

    packages:
    - apt-transport-https
    - ca-certificates
    - curl
    - gnupg
    - lsb-release
    # create the docker group
    groups:
    - docker

    # Add default auto created user to docker group
    system_info:
    default_user:
    groups: [docker]

    runcmd:
    - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
    - echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    - apt-get update
    - apt-get install -y docker-ce docker-ce-cli containerd.io
    - curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
    - chmod +x /usr/local/bin/docker-compose
    8 changes: 5 additions & 3 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -10,13 +10,15 @@ This repo provides a config and instructions for getting `multipass` setup to cr
    - Validate correct initialization with `multipass exec docker -- docker -v && docker-compose -v`
    - Run whatever you want within the image: `multipass shell docker`. You can also just call `multipass shell` since this is the default image

    **VSCode Use**
    ## VSCode Use

    You can use this image with VSCode Remote to program using docker inside of the image.

    - Find the IP of the running image with `multipass list`. You're looking for something like `192.168.64.X`
    - Add this as a remote in the VSCode Remote extension
    - You will want to mount your project directory into the image with `multipass mount`.
    - If you're in a project folder, you could do something like ```multipass mount . docker:/project/```. This is the folder you'll want to open using VSCode Remote
    - You will want to mount your project directory into the image with `multipass mount`. If you're in a project folder, you could do something like ```multipass mount . docker:/project/```. This is the folder you'll want to open using VSCode Remote

    ---

    **Helpful docs:**
    - [Multipass docs](https://multipass.run/docs)
  2. pmbaumgartner revised this gist Sep 1, 2021. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -10,14 +10,16 @@ This repo provides a config and instructions for getting `multipass` setup to cr
    - Validate correct initialization with `multipass exec docker -- docker -v && docker-compose -v`
    - Run whatever you want within the image: `multipass shell docker`. You can also just call `multipass shell` since this is the default image

    **VSCode Use**
    ## VSCode Use

    You can use this image with VSCode Remote to program using docker inside of the image.

    - Find the IP of the running image with `multipass list`. You're looking for something like `192.168.64.X`
    - Add this as a remote in the VSCode Remote extension
    - You will want to mount your project directory into the image with `multipass mount`. If you're in a project folder, you could do something like ```multipass mount . docker:/project/```. This is the folder you'll want to open using VSCode Remote

    ---

    **Helpful docs:**
    - [Multipass docs](https://multipass.run/docs)
    - [cloud-init examples & docs](https://cloudinit.readthedocs.io/en/latest/topics/examples.html)
  3. pmbaumgartner revised this gist Sep 1, 2021. 1 changed file with 23 additions and 24 deletions.
    47 changes: 23 additions & 24 deletions cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -1,28 +1,27 @@
    #cloud-config
    package_upgrade: true
    # Multipass Docker Setup

    ssh_authorized_keys:
    - <your key>
    This repo provides a config and instructions for getting `multipass` setup to create an Ubuntu image with docker & docker-compose for use on macOS.

    packages:
    - apt-transport-https
    - ca-certificates
    - curl
    - gnupg
    - lsb-release
    # create the docker group
    groups:
    - docker
    - [Download multipass](https://multipass.run/docs/installing-on-macos)
    - Update the included `cloud-init.yaml` file with your ssh key (`cat ~/.ssh/id_rsa.pub | pbcopy` should get it on your clipboard)
    - Create the multipass image with `multipass launch --cloud-init cloud-init.yaml --name docker`
    - You might need to upgrade the default settings to include more RAM/HDD space.
    - Feel free to change the `--name` argument to whatever you'd like to call this.
    - Validate correct initialization with `multipass exec docker -- docker -v && docker-compose -v`
    - Run whatever you want within the image: `multipass shell docker`. You can also just call `multipass shell` since this is the default image

    # Add default auto created user to docker group
    system_info:
    default_user:
    groups: [docker]
    **VSCode Use**

    runcmd:
    - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
    - echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    - apt-get update
    - apt-get install -y docker-ce docker-ce-cli containerd.io
    - curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
    - chmod +x /usr/local/bin/docker-compose
    You can use this image with VSCode Remote to program using docker inside of the image.

    - Find the IP of the running image with `multipass list`. You're looking for something like `192.168.64.X`
    - Add this as a remote in the VSCode Remote extension
    - You will want to mount your project directory into the image with `multipass mount`. If you're in a project folder, you could do something like ```multipass mount . docker:/project/```. This is the folder you'll want to open using VSCode Remote

    **Helpful docs:**
    - [Multipass docs](https://multipass.run/docs)
    - [cloud-init examples & docs](https://cloudinit.readthedocs.io/en/latest/topics/examples.html)

    **Helpful blogs:**
    - https://aaronmsft.com/posts/multipass/
    - https://www.freshblurbs.com/blog/2020/04/19/Multipass-Docker-Mac-Cassandra.html
  4. pmbaumgartner created this gist Sep 1, 2021.
    28 changes: 28 additions & 0 deletions cloud-init.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    #cloud-config
    package_upgrade: true

    ssh_authorized_keys:
    - <your key>

    packages:
    - apt-transport-https
    - ca-certificates
    - curl
    - gnupg
    - lsb-release
    # create the docker group
    groups:
    - docker

    # Add default auto created user to docker group
    system_info:
    default_user:
    groups: [docker]

    runcmd:
    - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
    - echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    - apt-get update
    - apt-get install -y docker-ce docker-ce-cli containerd.io
    - curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
    - chmod +x /usr/local/bin/docker-compose
    27 changes: 27 additions & 0 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    # Multipass Docker Setup

    This repo provides a config and instructions for getting `multipass` setup to create an Ubuntu image with docker & docker-compose for use on macOS.

    - [Download multipass](https://multipass.run/docs/installing-on-macos)
    - Update the included `cloud-init.yaml` file with your ssh key (`cat ~/.ssh/id_rsa.pub | pbcopy` should get it on your clipboard)
    - Create the multipass image with `multipass launch --cloud-init cloud-init.yaml --name docker`
    - You might need to upgrade the default settings to include more RAM/HDD space.
    - Feel free to change the `--name` argument to whatever you'd like to call this.
    - Validate correct initialization with `multipass exec docker -- docker -v && docker-compose -v`
    - Run whatever you want within the image: `multipass shell docker`. You can also just call `multipass shell` since this is the default image

    **VSCode Use**
    You can use this image with VSCode Remote to program using docker inside of the image.

    - Find the IP of the running image with `multipass list`. You're looking for something like `192.168.64.X`
    - Add this as a remote in the VSCode Remote extension
    - You will want to mount your project directory into the image with `multipass mount`.
    - If you're in a project folder, you could do something like ```multipass mount . docker:/project/```. This is the folder you'll want to open using VSCode Remote

    **Helpful docs:**
    - [Multipass docs](https://multipass.run/docs)
    - [cloud-init examples & docs](https://cloudinit.readthedocs.io/en/latest/topics/examples.html)

    **Helpful blogs:**
    - https://aaronmsft.com/posts/multipass/
    - https://www.freshblurbs.com/blog/2020/04/19/Multipass-Docker-Mac-Cassandra.html