Passing command line arguments in Docker Compose

Thanks for the speedy reply. Here’s my current compose.yaml snippet:

services:
  server:
    build:
      args:
         MODE: $MODE
    context: .
    target: MODE
…

Then running “MODE=prod docker compose up -d --build”

I get the following error message:

failed to solve: target stage MODE could not be found

Thanks for looking at this. Appreciate it. Rick.