Code Monkey home page Code Monkey logo

docker-multipass's Introduction

Docker with multipass on macOS

Prerequisites

$ brew install multipass

Usage

This will create and launch an instance called primary. Multipass by default will mount your $HOME directory if the instance is named primary.

$ ./create-and-init.sh
+ MEM=2048M
+ CPUS=2
+ DISK=20G
+ echo 'Creating and launching instance'
Creating and launching instance
+ multipass launch --name primary -c 2 -m 2048M -d 20G --cloud-init cloud-init.yml
Launched: primary
Mounted '/Users/chrisgoffinet' into 'primary:Home'
+ echo 'Mounting /Users/chrisgoffinet into remote instance: primary'
Mounting /Users/chrisgoffinet into remote instance: primary
+ multipass mount /Users/chrisgoffinet primary:/Users/chrisgoffinet
++ multipass info primary
++ grep IPv4
++ awk '{split($0,a," "); print a[2]}'
+ PRIMARY_INSTANCE=192.168.64.13
+ echo 'Success! in your bash profile add this:'
Success! in your bash profile add this:
+ echo 'export DOCKER_HOST=tcp://192.168.64.13:2375'
export DOCKER_HOST=tcp://192.168.64.13:2375

Now that your DOCKER_HOST is pointed to your primary instance running commands like you normally do should just work as expected.

$ docker pull busybox
Using default tag: latest
latest: Pulling from library/busybox
8ba530ca112c: Pull complete
Digest: sha256:15e927f78df2cc772b70713543d6b651e3cd8370abf86b2ea4644a9fba21107f
Status: Downloaded newer image for busybox:latest
docker.io/library/busybox:latest
$ docker images
REPOSITORY   TAG       IMAGE ID       CREATED      SIZE
busybox      latest    cc54699a1d7e   8 days ago   1.41MB
$ echo 'test 123' > test.txt
$ docker run --rm -it -v $PWD/test.txt:/test.txt busybox sh
/ # cat /test.txt
test 123
/ #

How do I configure disk, memory, and cpu?

You can configure the variables in the create-and-init.sh script.

MEM=2048M
CPUS=2
DISK=20G

Can this replace Docker Desktop?

Yes, on macOS you can install docker using brew, so no need to go and install Docker Desktop.

$ brew install docker

How do I shell into the instance?

$ multipass shell

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.