Error: multiple platforms feature is currently not supported for docker driver

I’m getting the following error when I try to start this application up using docker-compose on a M1 Mac:

[+] Building 0.0s (0/0)
multiple platforms feature is currently not supported for docker driver. Please switch to a different driver (eg. "docker buildx create --use")

I’ve tried to follow the advice here: [Docker] Docker buildx support multiple architectures images | Cloud-oriented Life but no change.

My environment:

  • Docker Desktop: Engine: 20.10.14, Compose: v2.5.1
  • Mac M1 OS 12.2.1

When running the following:

To start and run application locally for development:

docker buildx build --platform linux/amd64 -f Dockerfile.dev .; docker-compose up

Docker Compose file:

version: "3.8"

services:
  web:
    platform: linux/amd64
    build:
      context: .
      dockerfile: Dockerfile.dev
    ports:
      - 8000:80
    volumes:
      - ./app:/code/app
    env_file:
      - ./app/.env

Dockerfile

FROM --platform=linux/amd64 ubuntu:20.04

RUN apt-get update && apt-get install -y zip libaio1 libaio-dev software-properties-common gcc && \
    add-apt-repository -y ppa:deadsnakes/ppa

RUN apt-get update && apt-get install -y python3.10 python3.10-distutils python3-pip python3.10-dev \
    python3-apt libgl1 libxrender-dev libsm6 libxext6 curl

RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10

# Install Oracle Instance DB Client
# Tips on installing - https://stackoverflow.com/questions/70011858/libclntsh-so-cannot-open-shared-object-file-using-docker-oracle-python
RUN mkdir -p /opt/oracle
WORKDIR /opt/oracle/
COPY packages/instantclient-basiclite-linux.x64-21.5.0.0.0dbru.zip /opt/oracle/
RUN unzip /opt/oracle/instantclient-basiclite-linux.x64-21.5.0.0.0dbru.zip -d /opt/oracle/
RUN echo "export LD_LIBRARY_PATH=/opt/oracle/instantclient_21_5" >> /etc/profile
RUN echo "export PATH=/opt/oracle/instantclient_21_5:$PATH" >> /etc/profile
RUN echo "export ORACLE_HOME=/opt/oracle/instantclient_21_5" >> /etc/profile
RUN cd /opt/oracle/instantclient_21_5 && cd /opt/oracle/instantclient_21_5 && export PATH=/opt/oracle/instantclient_21_5:$PATH && export ORACLE_HOME=/opt/oracle/instantclient_21_5
RUN rm /opt/oracle/instantclient-basiclite-linux.x64-21.5.0.0.0dbru.zip
ENV LD_LIBRARY_PATH /opt/oracle/instantclient_21_5:$LD_LIBRARY_PATH
WORKDIR /code

COPY ./requirements.txt /code/requirements.txt

RUN python3.10 -m pip install --no-cache-dir -r /code/requirements.txt
RUN python3.10 -m pip install watchgod

ENV PYTHONPATH "${PYTHONPATH}:/code/app"

COPY ./app /code/app

WORKDIR /code/app

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "80", "--reload", "--reload-include", "*.yaml", "--reload-include", "*.j2", "--reload-include", "*.css"]

I could not reproduce your issue with Docker Compose v2.5.1 on Mac M1. It is true, docker itself does not support building for multiple platforms, but Docker Desktop can emulate platforms so it should have worked. I tried on Linux too (amd64) and I could not get the same error message.

Have you changed the builder configuration?

docker builder list

update:
The above command is wrong! I meant the following:

docker buildx ls
1 Like

I’m using Docker Desktop for Mac - 4.8.2 (79419)

When I run docker builder list - that subcommand is not found. I get the following.

> docker builder list

Usage:  docker builder COMMAND

Manage builds

Commands:
  build       Build an image from a Dockerfile
  prune       Remove build cache

Run 'docker builder COMMAND --help' for more information on a command.

Am I missing something?

Thanks!

Additional info that might be helpful to understand this

My Docker Engine v20.10.14 Configuration:

{
  "builder": {
    "gc": {
      "defaultKeepStorage": "20GB",
      "enabled": true
    }
  },
  "experimental": true,
  "features": {
    "buildkit": true
  }
}

docker buildx ls results

 > docker buildx ls
NAME/NODE       DRIVER/ENDPOINT             STATUS   PLATFORMS
modest_bohr     docker-container
  modest_bohr0  unix:///var/run/docker.sock inactive
mybuilder       docker-container
  mybuilder0    unix:///var/run/docker.sock stopped
desktop-linux   docker
  desktop-linux desktop-linux               running  linux/arm64, linux/amd64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6
default *       docker
  default       default                     running  linux/arm64, linux/amd64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6

No. Sorry, I meant docker buildx ls. I wrote my previous post too quickly.

It looks like your config is the same as mine including the versions, so I don’t know why it does not work for you.

The only difference I can see between your build and mine is that I could not try the whole Dockerfile since I don’t have the files from the host, but I doubt that could cause the error message. I only tried it with the first line where the platform is defined.

Check this link [Docker] Docker buildx support multiple architectures images | Cloud-oriented Life

2 Likes

So I nuked my entire installation (Docker for Desktop) and re-installed from scratch. Everything is now working fine (which makes me happy and sad at the same time :smile: )

Thanks everyone for your help and letting me know that it should work fine with no special configuration needed!

I’m running into this also with the same setup. I’m going to try a reinstall of Docker Desktop as well, but I wonder what’s causing it!

I to encountered this error. I uninstalled and reinstalled Docker Desktop, but the error remains.

Edit: So I had not followed the instructions closely enough. It does seem that it’s necessary to first follow the instructions at the link provided by edimoto.

When I said nuked my Docker installation above I should have been clearer, it meant: 1. uninstall 2. clean out all files left over 3. install 4. do a docker system reset just to make sure I didn’t have anything left over.

:smile: