Skip to content

Unable to get docker-language-server to recognize compose files #453

@miversen33

Description

@miversen33

I recently found this project and figured I would see how well it works. Unfortunately it seems that I am unable to get the lsp to treat a docker compose file as that. For some reason it seems stuck on the idea that docker-compose.yml is actually a dockerfile.

I am not seeing any sort of switch I need to provide to tell the lsp that the file its looking at is a docker compose file, so I assume this is something that should be handled automagically.

I am using neovim with the inbuilt vim.lsp configuration. My configuration is pretty simple,

    config = {
        filetypes = { "dockerfile", "yaml" },
        cmd = { "docker-language-server", "start", "--stdio" },
    }

Note specifically I am not limiting this to docker-compose.yml files currently, just as a test.

Below is the example docker compose file I am trying to use

services:
  web:
    build: .
    ports:
      - "8000:5000"
  redis:
    image: "redis:alpine"

And as you can see in my screenshot, the lsp is confused

Image

This is with version: docker-language-server version 2025-08-12-07d5add

Here is the output from the lsp log (I am assuming but not certain that neovim dumps stderr from the lsp to this file)

[START][2025-08-21 21:24:50] LSP logging initiated
[WARN][2025-08-21 21:24:50] .../lua/vim/lsp.lua:439     "docker does not have a configuration"
[WARN][2025-08-21 21:24:50] .../lua/vim/lsp.lua:439     "yamlls does not have a configuration"
[WARN][2025-08-21 21:24:50] ...m/lsp/client.lua:874     "The language server yamlls triggers a registerCapability handler for workspace/didChangeConfiguration despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[ERROR][2025-08-21 21:24:51] ...m/lsp/client.lua:619    "LSP[docker]"   "Cannot find request with id 4 whilst attempting to cancel"
[ERROR][2025-08-21 21:24:51] ...p/_transport.lua:36     "rpc"   "/home/miversen/.local/share/nvim/miversen/lsps/docker/docker"  "stderr"   '2025/08/21 21:24:51 jsonrpc2 handler: notification "$/cancelRequest" handling error: jsonrpc2: code -32601 message: method not supported: $/cancelRequest\n'

One thing that is interesting is that this seems to only affect diagnostics. Completion recommendations appear to work just fine. I am not super versed in LSP stuff so I don't know what exactly that means

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions