element-hq / element-hq/dendrite

`docker build` fails on macOS + colima

Open
#3,370 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
965
Forks
101
PR merge metrics
No merged PRs in 30d

Description

*This issue was originally created by [**@Amar1729**](https://github.com/Amar1729) at .*

### Background information

- **Dendrite version or git SHA**: `v0.13.7`
- **SQLite3 or Postgres?**: n/a
- **Running in Docker?**: yes
- `docker --version`: `Docker version 26.1.1, build 4cf5afaefa`
- `colima --version`: `colima version 0.6.8`
- **`go version`**: n/a
- **Client used (if applicable)**: n/a

### Description

- **What** is the problem: `docker build` fails on **m1 (arm64) mac mini** while using [colima](https://github.com/abiosoft/colima) as a provider
- **Who** is affected: users trying to serve `dendrite` from an arm Mac
- **How** is this bug manifesting: (see steps to repro)
- **When** did this first appear:

### Steps to reproduce

```
~/Documents/matrix/dendrite $ colima version
colima version 0.6.8
git commit: 9b0809d0ed9ad3ff1e57c405f27324e6298ca04f

runtime: docker
arch: aarch64
client: v26.1.1
server: v24.0.9

~/Documents/matrix/dendrite $ docker build -t matrixdotorg/dendrite-monolith .
DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
Install the buildx component to build images with BuildKit:
https://docs.docker.com/go/buildx/

Sending build context to Docker daemon 64.91MB
Step 1/23 : FROM --platform=${BUILDPLATFORM} docker.io/golang:1.21-alpine3.18 AS base
failed to parse platform : "" is an invalid component of "": platform specifier component must match "^[A-Za-z0-9_-]+$": invalid argument
```

However, there's a workaround: `ssh` into colima's VM, and then issue `docker build` from there.

```
$ colima ssh
amar@colima:/Users/amar/Documents/matrix/dendrite$ docker build -t matrixdotorg/dendrite-monolith .

```

I have deleted + re-initialized the `colima` VM to ensure i was building from a clean slate. I think that this actually might be some kind of an issue with how `colima` is setting certain variables, or communicating with the docker client. Since I figured out a workaround, i thought I would post it here in case anybody runs into the same issue (but I'm not yet sure why exactly this is happening?).

I did try `docker build` with `--platform arm64` (and others) based on the error message, but that didn't result in anything different.

Contributor guide

Open the contributing guide

Research direction

Reproduce `docker build -t matrixdotorg/dendrite-monolith .` on an M1 macOS host using Colima 0.6.8 and Docker 26.1.1, then compare it with the working build from `colima ssh`. Trace why `BUILDPLATFORM` is empty in the reported platform error; done means the documented build command succeeds without entering the Colima VM.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
build-system, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.