DEV Community

Aleksandar Zec
Aleksandar Zec

Posted on

Building older Linux Docker images on macbook M1 M2

The problem occurs when you try to build older linux images on Docker. It's about different cpu architecture which is present on newer cpus. To "force" mac to build image in right way, you need to add "platform: linux/amd64" in docker-compose.yml file.

Example:

version: "3.3"

services:
  web:
    platform: linux/amd64      
    build: .
    command: python ./"PathToProject"/portal/manage.py runserver 0.0.0.0:8000
    volumes:
      - .:/"projectImage"
    ports:
      - "8000:8000"
Enter fullscreen mode Exit fullscreen mode

Only problem is that it will be slow because of that linux/amd64 emulation, but at least it works ;).

Top comments (0)