Docker Compose on M1 Failing on Startup

I am trying to Build a Ruby On Rails project inside of a Docker Compose. I got it working for the most part but for some reason I am having trouble with docker compose up when running. It will fail after the build, but then if I rerun the docker compose up it will succeed with no problem.

Error on compose up
failed to solve: no match for platform in manifest

Basic Docker Compose file

version: '3'

    image: postgres:13-alpine
    user: postgres
      - POSTGRES_DB=test-db
      - POSTGRES_HOST=localhost
        - CMD-SHELL
        - pg_isready -d test-db
      interval: 10s
      timeout: 5s
      retries: 5
    image: redis:6
      - ''
        - CMD-SHELL
        - redis-cli ping
      interval: 10s
      timeout: 5s
      retries: 5
    tty: true
    platform: linux/x86_64
      context: .
        - ENVIROMENT=development
    entrypoint: 'rails db:setup && rails s'
      - db
      - redis

My OS: 13.4.1 (22F82) M1 Pro
Docker Version: Docker version 24.0.2, build cb74dfc

Changing platform to linux/amd64 didn’t seem to make a difference either for whatever reason.

Features enabled:
Use Virtualization framework
Use Rosetta for x86/amd64 emulation on Apple Silicon (Checking or unchecking this doesn’t seem to make a difference)

I’m not sure about the issue, but the platform for amd64 images is usually linux/amd64 not linux/x86_64 so if there is a bug of recognizing the alias, that could be a reason.

You can also try to set the platform in the build section:


platforms defines a list of target platforms.

 context: "."
   - "linux/amd64"
   - "linux/arm64"

When the platforms attribute is omitted, Compose includes the service’s platform in the list of the default build target platforms.

When the platforms attribute is defined, Compose includes the service’s platform, otherwise users won’t be able to run images they built.

Composes reports an error in the following cases:

  • when the list contains multiple platforms but the implementation is incapable of storing multi-platform images
  • when the list contains an unsupported platform

It is also possible that the base image just doesn’t support the architecture and it will build the image for the supported architecture the second time (still could be a bug).

In case of Docker Desktop, the version of Docker Desktop is more important. Can you share that too? Based on the Docker version I guess you are using the latest version, but I don’t remember the Docker version in the desktop previous version so I’m not sure.

Here is that setup:


4.21.1 (114176)

Engine: 24.0.2

Compose: v2.19.1

Credential Helper: v0.7.0

Kubernetes: v1.27.2