Validating error "(root) must be a mapping" after update the docker and docker-compose

My system info:
OS: Fedora Linux 39 (Workstation Edition)
docker: 25.0.0
docker-compose: 1.29.2

Here is my docker compose override file.

version: "3"

services:
  server:
    command: sh -c "./manage.py migrate && ./manage.py runserver 0.0.0.0:9000"
    env_file: .env
    ports:
      - "8000:9000"
    volumes:
      - ./organicauras:/code

After runnig docker compose up I am getting this issue:

validating /home/rahul/workstation/organicauras/docker-compose.override.yml: (root) must be a mapping

That file probably contains a non-printable character. Otherwise it would not complain about the root of the yaml not being a mapping, Try to create a new file and type the code again to see if that’s the case.

You should also use Docker Compose v2, not v1 which is not supportedanymore

My system info:
OS: Ubuntu 23.10
docker: 25.0.0
docker-compose: 2.24.1

My docker compose file (generated by vscode devcontainer)

$HOME/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data/docker-compose/docker-compose.devcontainer.build-1705656232830.yml:

version: '3.2'
services:
  dev:
    build:
      dockerfile: /tmp/devcontainercli-eryk/container-features/0.54.1-1705656232828/Dockerfile-with-features
      args:
        - BUILDKIT_INLINE_CACHE=1
        - _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label

Checked non-printable characters, only spaces and '\n’s.
Was working until docker upgrade:

Commandline: aptdaemon role='role-commit-packages' sender=':1.720'
Upgrade: docker-compose-plugin:amd64 (2.21.0-1~ubuntu.22.04~jammy, 2.24.1-1~ubuntu.22.04~jammy), docker-ce-cli:amd64 (5:24.0.7-1~ubuntu.22.04~jammy, 5:25.0.0-1~ubuntu.22.04~jammy), docker-buildx-plugin:amd64 (0.11.2-1~ubuntu.22.04~jammy, 0.12.1-1~ubuntu.22.04~jammy), docker-ce:amd64 (5:24.0.7-1~ubuntu.22.04~jammy, 5:25.0.0-1~ubuntu.22.04~jammy), docker-ce-rootless-extras:amd64 (5:24.0.7-1~ubuntu.22.04~jammy, 5:25.0.0-1~ubuntu.22.04~jammy)
End-Date: 2024-01-20  22:10:29 

EDIT

reverting the upgrade makes it work again:
sudo apt-get install docker-compose-plugin:amd64=2.21.0-1~ubuntu.22.04~jammy docker-ce-cli:amd64=5:24.0.7-1~ubuntu.22.04~jammy docker-buildx-plugin:amd64=0.11.2-1~ubuntu.22.04~jammy docker-ce:amd64=5:24.0.7-1~ubuntu.22.04~jammy docker-ce-rootless-extras:amd64=5:24.0.7-1~ubuntu.22.04~jammy

It seems that a fix is on the way

A temporary solution is to downgrade your docker-compose-plugin package below 2.24.1

1 Like

Than you for sharing the github link! I wouldn’t have noticed it probably, since I always pass build arguments and environment variables as a mapping, not a list. And I’m still using v2.23, because I wanted to wait with the upgrade.

I upgrade my docker-compose now the version is v2.24.1. Also I create another file and type the codes there but its return the same error.
(sorry for late reply I was sick )

You downgrade your docker compose and its working right???

Yep, in my case the downgrade was (ubuntu): sudo apt-get install docker-compose-plugin:amd64=2.21.0-1~ubuntu.22.04~jammy docker-ce-cli:amd64=5:24.0.7-1~ubuntu.22.04~jammy docker-buildx-plugin:amd64=0.11.2-1~ubuntu.22.04~jammy docker-ce:amd64=5:24.0.7-1~ubuntu.22.04~jammy docker-ce-rootless-extras:amd64=5:24.0.7-1~ubuntu.22.04~jammy

Thank you everyone, After update my version it is working fine