Docker-ce 25.0.0 validating docker-compose.override.yml failed environment array items[0,1] must be unique

Since docker-ce 25.0.0 override environment variable with the same value than parent failed.
OS: Debian 11 or Unbuntu 22.0.4

Reproduce:
Two docker-compose file in web directory:

web/docker-compose.yml:

services:
  web:
    image: traefik/whoami
    environment:
      TEST: 2

web/docker-compose.override.yml

services:
  web:
    environment:
      TEST: ${TEST}
web$ TEST=1 docker compose config 
name: web
services:
  web:
    environment:
      TEST: "1"
    image: traefik/whoami
    networks:
      default: null
networks:
  default:
    name: web_default
web$ TEST=2 docker compose config
validating /app/web/docker-compose.override.yml: services.web.environment array items[0,1] must be unique

I should override TEST environment value with whatewer independently of parent docker-compose.yml value.
This work perfectly before on 24.0.X.

1 Like

Encountering the same problem as highlighted by the user. Ever since the docker-ce version 25.0.0 update, attempting to override an environment variable with the same value as the parent container is failing. This issue persists across both Debian 11 and Ubuntu 22.0.4 operating systems.

1 Like

I have open a bug: docker compose config or run: validating docker-compose.override.yml failed environment array items[0,1] must be unique · Issue #47122 · moby/moby · GitHub

" Thanks for reporting; this looks to be an issue with Docker Compose, which is a separate project, and not maintained here.

It looks like this issue was already reported, and a fix was implemented (but not yet released)

I’ll close this ticket here, as there’s nothing actionable in this repository, and it looks like the issue is already addressed in the compose repository.