Search code examples
docker-compose

docker compose: Additional property content is not allowed


My Docker version is 25.0.5 (both client and server). My docker compose version is v2.29.1. Swarm init is done.

For the simply Compose file:

configs:
  cfg:
    content: This is my content

Running docker stack config or docker stack deploy fails with error.

# docker stack config -c cfg.yaml 
configs.cfg Additional property content is not allowed
# docker stack deploy -c cfg.yaml p1
configs.cfg Additional property content is not allowed

As per the documentation, the property content and environment is added in v2.23.1. I am using the docker compose version v2.29.1. I also tried with the specific versions v2.23.1 and v2.23.2, but met with the same error.

What am I missing?

PS: As far as I can see with tcpdump, the docker stack commands do not go up to the server, but the errors are coming from the client only (ie docker compose).

# docker version
Client:
 Version:           25.0.5
 API version:       1.44
 Go version:        go1.21.8
 Git commit:        5dc9bcc
 Built:             Tue Mar 19 15:04:17 2024
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          25.0.5
  API version:      1.44 (minimum version 1.24)
  Go version:       go1.21.8
  Git commit:       e63daec
  Built:            Tue Mar 19 15:05:39 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.7.13
  GitCommit:        7c3aca7a610df76212171d200ca3811ff6096eb8
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
# docker compose version
Docker Compose version v2.29.1
#

Solution

  • Ah, I missed this completely. As per the docker stack docs

    The docker stack deploy command uses the legacy Compose file version 3 format, used by Compose V1. The latest format, defined by the Compose specification isn't compatible with the docker stack deploy command.

    For more information about the evolution of Compose, see History of Compose.

    So, I have no real solution and wait for docker stack to support the new Compose spec. Hmm.