'Command failed docker-compose in VScode Devcontainer

I've just started using Docker on an already existing project (it runs into a Docker container). I don't have a lot of Docker background - I've been using it only from the GUI, by pressing the "play" button.

Now I have a project which runs into a container, and I'm having trouble starting it.

I'm getting this error:

[2022-03-31T15:30:27.408Z] Error: Command failed: docker-compose -f c:\Users\Octavian\Desktop\django-analyzer\docker-compose.dev.yml config
[2022-03-31T15:30:27.408Z]     at Ru (c:\Users\Octavian\.vscode\extensions\ms-vscode-remote.remote-containers-0.231.1\dist\spec-node\devContainersSpecCLI.js:209:813)
[2022-03-31T15:30:27.408Z]     at processTicksAndRejections (node:internal/process/task_queues:96:5)
[2022-03-31T15:30:27.408Z]     at async dR (c:\Users\Octavian\.vscode\extensions\ms-vscode-remote.remote-containers-0.231.1\dist\spec-node\devContainersSpecCLI.js:181:643)
[2022-03-31T15:30:27.408Z]     at async hR (c:\Users\Octavian\.vscode\extensions\ms-vscode-remote.remote-containers-0.231.1\dist\spec-node\devContainersSpecCLI.js:178:2075)
[2022-03-31T15:30:27.408Z]     at async RR (c:\Users\Octavian\.vscode\extensions\ms-vscode-remote.remote-containers-0.231.1\dist\spec-node\devContainersSpecCLI.js:223:2195)
[2022-03-31T15:30:27.408Z]     at async Jw (c:\Users\Octavian\.vscode\extensions\ms-vscode-remote.remote-containers-0.231.1\dist\spec-node\devContainersSpecCLI.js:223:3221)
[2022-03-31T15:30:27.409Z]     at async TR (c:\Users\Octavian\.vscode\extensions\ms-vscode-remote.remote-containers-0.231.1\dist\spec-node\devContainersSpecCLI.js:223:13880)
[2022-03-31T15:30:27.409Z]     at async FR (c:\Users\Octavian\.vscode\extensions\ms-vscode-remote.remote-containers-0.231.1\dist\spec-node\devContainersSpecCLI.js:223:13605)
[2022-03-31T15:30:27.417Z] Stop (3507 ms): Run: C:\Users\Octavian\AppData\Local\Programs\Microsoft VS Code\Code.exe c:\Users\Octavian\.vscode\extensions\ms-vscode-remote.remote-containers-0.231.1\dist\spec-node\devContainersSpecCLI.js up --container-data-folder .vscode-server/data/Machine --container-system-data-folder /var/vscode-server --workspace-folder c:\Users\Octavian\Desktop\django-analyzer --workspace-mount-consistency cached --id-label vsch.local.folder=c:\Users\Octavian\Desktop\django-analyzer --id-label vsch.quality=stable --log-level debug --config c:\Users\Octavian\Desktop\django-analyzer\.devcontainer\devcontainer.json --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2022-03-31T15:30:27.417Z] Exit code 1
[2022-03-31T15:30:27.420Z] Command failed: C:\Users\Octavian\AppData\Local\Programs\Microsoft VS Code\Code.exe c:\Users\Octavian\.vscode\extensions\ms-vscode-remote.remote-containers-0.231.1\dist\spec-node\devContainersSpecCLI.js up --container-data-folder .vscode-server/data/Machine --container-system-data-folder /var/vscode-server --workspace-folder c:\Users\Octavian\Desktop\django-analyzer --workspace-mount-consistency cached --id-label vsch.local.folder=c:\Users\Octavian\Desktop\django-analyzer --id-label vsch.quality=stable --log-level debug --config c:\Users\Octavian\Desktop\django-analyzer\.devcontainer\devcontainer.json --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2022-03-31T15:30:27.421Z] Exit code 1

Here's my docker-compose.yml (if it helps)

version: '3.7'

services:
  redis:
    //data

  postgres:
    //data

  django:
    //data

volumes:
  db-data:

Where can this error come from and how can I fix it?

Thanks.



Solution 1:[1]

It looks like you're trying to VS Code devcontainers. The error output is not super helpful here.

docker-compose seems to not like the format of your docker-compose.dev.yml file because it errors out on:

docker-compose -f c:\Users\Octavian\Desktop\django-analyzer\docker-compose.dev.yml config

Try running that command at your command line and it should give you better info on why your docker-compose.dev.yml is invalid.

Solution 2:[2]

Try to check your docker version. then select the appropriate compactibility version from HERE then try this for official HERE or you can try this one for template compose file HERE

Make sure your docker is propery installed on your local machine.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 dana nadler
Solution 2 piash tanjin