skip to Main Content

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:

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


  1. Chosen as BEST ANSWER

    And just to help somebody avoid unnecessary googling.

    Upgrading compose plugin installed using official docker apt repo:

    COMPOSE_VERSION="v2.23.3"
    apt purge docker-compose-plugin
    curl -SL "https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-linux-x86_64" -o /usr/libexec/docker/cli-plugins/docker-compose
    chmod a+rx /usr/libexec/docker/cli-plugins/docker-compose
    

  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search