Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Flex's avatar
Level 4

docker-compose up command did not work well

working with Laravel 9 and I have installed docker toolkit as well and I am running windows 7 as well. when I run docker-compose up command it is generating following error message in my cmd

Version in ".\docker-compose.yml" is unsupported. You might be seeing this error because you're using the wrong Compose file version. Either specify a
supported version (e.g "2.2" or "3.3") and place your service definitions under the `services` key, or omit the `version` key and place your service definitions at the root of the file to use version 1.
For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/

my docker-compose.yml file is like this

version: "2.2"
services:
  mysql:
    image: mariadb:10.8.3
    # Uncomment below when on Mac M1
    platform: linux/arm64/v8
    command: --default-authentication-plugin=mysql_native_password
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: root
    ports:
      - 3306:3306
  adminer:
    image: adminer
    restart: always
    ports:
      - 8080:8080

how could I fix this problem as well?

0 likes
4 replies
LaryAI's avatar
Level 58

The error message suggests that the version specified in the docker-compose.yml file is not supported. The solution is to either specify a supported version (e.g. "2.2" or "3.3") and place the service definitions under the "services" key, or omit the "version" key and place the service definitions at the root of the file to use version 1.

In this case, the version specified in the docker-compose.yml file is "2.2", which is a supported version. However, the service definitions are not placed under the "services" key. To fix this, simply move the service definitions under the "services" key like this:

version: "2.2"
services:
  mysql:
    image: mariadb:10.8.3
    # Uncomment below when on Mac M1
    platform: linux/arm64/v8
    command: --default-authentication-plugin=mysql_native_password
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: root
    ports:
      - 3306:3306
  adminer:
    image: adminer
    restart: always
    ports:
      - 8080:8080

Save the file and run the "docker-compose up" command again. It should work now.

enoch91's avatar

@flex there is nothing wrong with your docker-compose.yml file because I tested your file on my local PC (Macbook Pro) and it worked perfectly, I think it has to do with your machine, kindly check that you've installed docker-compose correctly and it's the updated version, and ensure that docker is running on your machine.

I believe you should be good if your machine is checked and updated to run docker.

Cheers.

Please or to participate in this conversation.