Fix broken Docker Development on Macbook M1

Docker is not supported on Apple M1 MacBooks and Mini

Docker Logo
[Docker Logo]

Docker is based on golang and needs virtualization support. Getting go to support the new architecture is not a problem and will be solved soon.

The big problem is virtualization support which was always a problem for docker on windows where Windows Home had no support and not all Chips used for PC had the required chipsets.

Docker has posted a blog post which did a good explaination of all the problems which all need to be solved:

  • migrate to new hypervisor framework (does not exist in public version of Big Sur)
  • multi-architecture builds
  • golang with native M1 support
  • Electron with native M1 support for Docker Desktop - but works based on the info in the post

What is the time frame for this roadmap

Looking at the links to the roadmap in the blog, you will quickly find out that there is none. Based on the complexity of the project and the dependency on Apple I would expect minimum 6 to 8 months for this to be fixed. The only possibility to solve this quicker would be a direct involvement of Apple which has not happened in the past.

Intermediate solutions with a M1 MacBook Air / Pro

Move your Docker Development Environment into the Cloud:

Docker Engine

Use any local or cloud hosted linux host and install docker.

Ways to access the Docker Engine: 1) ssh to remote host and run all command on the remote host 2) access the docker api from the local operating_system

I suggest option 2) and the usage of Docker Contexts: 1) create once context to the remote system docker context create remote ‐‐docker "host=ssh://user@remotemachine" 2) now you can switch the default context with docker context use remote or use the --context option e.g. docker-compose ‐‐context remote up -d

Pros:

  • no dependency on any progress with the M1 Architecture
  • 3 times more speed for filesystem access
  • any hardware requirement is possible

Cons:

  • breaks any work flow which depends on mounting the local MacOS filesystem into Docker (see Fix mounting )

Docker Machine

Docker Machine Architecture
[Docker Machine Architecture]

Docker Machine supports creating Docker hosts on any local Computer (Intel Architecture) or Cloud Provider (Digital Ocean, AWS, KVM,...) and more

Pros:

  • no dependency on any progress with the M1 Architecture
  • 3 times more speed for filesystem access
  • any hardware requirement are possible

Cons:

  • breaks any work flow which depends on mounting the local MacOS filesystem into Docker (see Fix mounting )
  • official Docker Machine is no longer supported and there will be no further Development

Cloud Container Development (Blimp)

Blimp Logo
[Blimp Logo]

Blimp is a drop-in replacement for Docker Compose that enables development in the cloud.

Pros:

  • no dependency on any progress with the M1 Architecture
  • 3 times more speed for filesystem access
  • some hardware requirement are possible
  • mounting local volumes into container is built-in with synchronization

Cons:

  • has some restrictions on mounting, volumne drivers, DNS
  • does not support host.docker.internal
  • lock-in with their comandline client
  • you cannot choose your cloud provider

Cloud based Development Environment

Codespaces
[Codespaces]

A full Development Environment in the Browser which includes VS Code, Github Actions for CI/CD and a cloud hosted virtual machine automatical started and setup on each editor launch.

When Github Codespaces will become public they will allow to run Docker based Environments in the cloud.

Pros:

  • any local Harware or Operating System with a reason Browser sufficiant
  • 3 times more speed for filesystem access
  • any hardware requirement availiable on Microsoft Azure

Cons:

  • constant internet access required, no offline defelopment
  • lock-in with Microsoft hosting

Fix mounting local MacOS filesystem Problem

Visual Studio Code Remote Development allows to use Docker Compose to setup complex enviroments and connect with the container.

VS Code Remote development architecture
[VS Code Remote development architecture]

VS Code will run on MacOS and offer native M1 Power but the Terminal and files are directly edited inside Containers. This allows to stay with existing development workflows in depend of the docker engine running on another host.

The .devcontainer/ configuration additional add support for port forwarding which helps to establish an environment similar to having everything local.

My personal Roadmap to a M1 based MacBook

I am currently using a 13" MacBook Pro 2016, Intel 3.3 GHz i7 and was planning to switch to a new MacBook Pro i7/32GB which I had ordered beginning of September. When Apple presented the new MacBooks with M1 Chip I immediately canceled the order.

My current development environment for web based application and services is based on:

  • Docker Desktop for Mac
  • brew (node, yarn,..)
  • VirtualBox (Windows Browser Tests)

Hardware:

  • 2x Samsung Monitors (1920x1200)
  • HP Dockingstation G5

The only problem I have with current setup is Speed - some of my bigger php application eat a lot of memory and cpu.

I first thought after studying benchmarks and posts that my only problem is VirtualBox. Buying a Stick PC solved this and gives me a native local windows hardware for less than 90€.

But the NO Docker support made it clear that I will wait for the next generation of the MacBook Pro with more Memory and updated version of Big Sure and Docker.

In the meantime, I will test developing in the cloud which is no option for locations without good internet access :-(

What are your plans to develop with docker / kubernetics?

Write a response on Medium