Docker error on portainer Build invalid reference format

I got this error when trying to deploy a stack. I set the docker-compose.yml file to use and link to the git repo I get this error:

Build invalid reference format

So my first thought was that the docker-compose version was too high 3.7, but that wasn’t the problem.

The problem was that this docker compose was structured for development - ie. it relied on the code being local and building the image.

When you deploy to production there is nothing to build only an image to pull and set commands or env variabled.

So I change the docker-compose.yml from:

web: build: . command: python runserver volumes: - .:/code ports: - “8000:8000” env_file: - ./ depends_on: - db

and added a production.yml:

  command: /bin/bash
    - "8000:8000"
    - ./
    - db

So it is now pulling the image from the repo and running the command to set it up