skip to Main Content

I am attempting to use "docker-compose up" on the command line to run a simulator using noVNC but am getting the error "image with reference [my image] was found but does not match the specified platform: wanted linux/amd64, actual: linux/arm64/v8". I’ve seen some solutions for docker run and docker build, but docker-compose doesn’t seem to take the platform argument on the command line. Any ideas? Does it have anything to do with the Ubuntu virtual machine that’s acting as the host in this case?

I have added the "–platform" flag within the Dockerfile, added "platform: linux/amd64" inside docker-compose.yaml, and even attempted to set the default platform using "export DOCKER_DEFAULT_PLATFORM=linux/amd64", but the error keeps coming back.

2

Answers


  1. You can make it using args

    ARG plateform=linux/amd64
    FROM --platform=$plateform debian:bookworm-slim
    

    and put in your docker-compose.yml

    services:
      your_service:
        build:
          dockerfile: ./Dockerfile
          args:
            plateform: "<your_plateform>"
    
    Login or Signup to reply.
  2. You should declare platform with linux/amd64 inside of service. For sample can use this form my project.

    version: '3.7'
    
    services:
      app:
        build:
          context: .
          dockerfile: ./Dockerfile.dev
        container_name: be
        platform: linux/amd64
        restart: unless-stopped
        expose:
          - 5001
        ports:
          - 5001:5000
        volumes:
          - .:/app/
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search