docker-compose.yml
version: "3.8"
services:
test:
image: busybox:latest
configs:
- source: cfg
target: /opt/cfg.json
mode: "0644"
configs:
cfg:
content: "{}"
docker compose -f docker-compose.yml up
validating /opt/docker-compose.yml: configs.cfg Additional property content is not allowed
Docker documentation on these docker-compose.yml sections:
- https://docs.docker.com/compose/compose-file/08-configs/#example-2
- https://docs.docker.com/compose/compose-file/05-services/#long-syntax
Latest docker release is installed from official Docker apt repo. Versions:
Client: Docker Engine - Community
Version: 24.0.7
API version: 1.43
Server: Docker Engine - Community
Engine:
Version: 24.0.7
API version: 1.43 (minimum version 1.12)
Docker Compose version v2.21.0
2
Answers
And just to help somebody avoid unnecessary googling.
Upgrading compose plugin installed using official docker apt repo:
Docker Compose 2.21.0 does not support this feature – you’ll need 2.23.0 at least, if not 2.23.1.
See discussion at https://github.com/compose-spec/compose-spec/pull/429