Docker-Compose results in The platform targeted with the current context is not supported

Viewed 683

I am running local testing on macOS using docker-compose and I believe I'm following the getting started documentation exactly. But I get the following error:

% docker-compose up
ERROR: The platform targeted with
the current context is not supported.
Make sure the context in use
targets a Docker Engine.

Any idea why that is happening? Docker Desktop is running.

Versions:

  • OSX 12.2.1
  • Docker Desktop 4.5.0
  • docker-compose version 1.29.2, build 5becea4c
  • docker-py version: 5.0.0

Key files:

Dockerfile:

# syntax=docker/dockerfile:1
FROM python:3.7-alpine
WORKDIR /code
ENV FLASK_APP=app.py
ENV FLASK_RUN_HOST=0.0.0.0
RUN apk add --no-cache gcc musl-dev linux-headers
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
EXPOSE 5000
COPY . .
CMD ["flask", "run"]

docker-compose.yml:

version: "3.9"
services:
  web:
    build: .
    ports:
      - "8000:5000"
  redis:
    image: "redis:alpine"
1 Answers

Use docker compose up instead of docker-compose up. Also if you are deploying to ECS, the asymmetrical port mapping "8000:5000" will not work. The port mapping has to be symmetrical. Lastly, if you are deploying to ECS, the build will not work as expected. You can read more about the supported fields here. https://docs.docker.com/cloud/ecs-compose-features/. So you have to build the image in your local and tag it as <accontId>.dkr.ecr.us-west-2.amazonaws.com/<imageName> and push it to ecs and use the image in your docker-compose file.

Related