Running TypeScript Language Server in Docker?

I’ve got tsserver running locally with Neovim and everything works great. Now I’d like to put tsserver into a Docker container so I can have LSP goodness without needing to install Node on my host machine. I saw the article about doing something similar with C (Running language servers in containers · neovim/nvim-lspconfig Wiki · GitHub) and did the same, modifying my container and script to my NodeJS requirements. I’m pretty sure nvim-lspconfig was setup correctly, and at times a client did seem to connect, but then it would disconnect and report the client exited with a status of 1.

I enabled logging for LSP, but I never saw any reason why the client was disconnecting—the only messages in the log were either DEBUG or INFO. The container logs were silent, so no leads there either. I was running typescript-language-server --stdio in my container, and I could (sporadically) see a connected client when viewing the output of :LspInfo, but it never lasted more than a second. I had the container running continuously with tail -f /dev/null as the ENTRYPOINT, and it remained up while the client was thrashing.

Does anyone know how I might get more visibility into this problem? I feel like I’m close to figuring this out… If it’s helpful to see the scripts/Dockerfile/nvim config, lemme know what I should post. If anyone else has successfully done this I’d love to hear how! Thanks.

Have you tried GitHub - lspcontainers/lspcontainers.nvim: Neovim plugin for lspcontainers.

I have not tried it myself, but they have support for running typescript language server in a docker container.

Ahh, no I haven’t, but because I didn’t know it existed! Thanks, I will definitely check this out.

Any news about this topic?

After stucking for a while trying to make it work with tsserver, I tried to use another LSP to check if it works. And thankfully, when I tried to use Neovim LSP client with a docker container running Ruby’s solargraph, it worked.

Even though, when trying with the tsserver’s one, I have the same problem: the container doesn’ last.