{"id":13861563,"url":"https://github.com/emacs-lsp/lsp-docker","last_synced_at":"2025-07-14T09:32:25.023Z","repository":{"id":40350392,"uuid":"199784101","full_name":"emacs-lsp/lsp-docker","owner":"emacs-lsp","description":"Scripts and configurations to leverage lsp-mode in docker environment","archived":false,"fork":false,"pushed_at":"2024-04-19T14:28:01.000Z","size":6348,"stargazers_count":237,"open_issues_count":15,"forks_count":34,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-05-01T11:36:35.764Z","etag":null,"topics":["docker","lsp-mode","starter-kit"],"latest_commit_sha":null,"homepage":"","language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emacs-lsp.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-31T05:18:47.000Z","updated_at":"2024-05-03T03:49:19.294Z","dependencies_parsed_at":"2024-02-19T19:16:34.666Z","dependency_job_id":"63a5cbe0-b0a1-431b-bebb-900234eecb74","html_url":"https://github.com/emacs-lsp/lsp-docker","commit_stats":{"total_commits":203,"total_committers":21,"mean_commits":9.666666666666666,"dds":0.6995073891625616,"last_synced_commit":"16a0cfbe06813a1191b19e412445f9d34cd7493f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emacs-lsp%2Flsp-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emacs-lsp%2Flsp-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emacs-lsp%2Flsp-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emacs-lsp%2Flsp-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emacs-lsp","download_url":"https://codeload.github.com/emacs-lsp/lsp-docker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225908852,"owners_count":17543486,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","lsp-mode","starter-kit"],"created_at":"2024-08-05T06:01:25.181Z","updated_at":"2025-07-14T09:32:25.004Z","avatar_url":"https://github.com/emacs-lsp.png","language":"Emacs Lisp","funding_links":[],"categories":["Emacs Lisp"],"sub_categories":[],"readme":"\n#+ATTR_HTML: align=\"center\"; margin-right=\"auto\"; margin-left=\"auto\"\n=lsp-mode= uses =lsp-docker= to run language servers using in containers\n\n[[./images/logo.png]]\n\n[[https://melpa.org/#/lsp-docker][file:https://melpa.org/packages/lsp-docker-badge.svg]]\n[[https://stable.melpa.org/#/lsp-docker][file:https://stable.melpa.org/packages/lsp-docker-badge.svg]]\n[[https://github.com/emacs-lsp/lsp-docker/actions][file:https://github.com/emacs-lsp/lsp-docker/workflows/CI/badge.svg]]\n\n* Table of Contents                                       :TOC_4_gh:noexport:\n  - [[#preconfigured-language-servers][Preconfigured language servers]]\n  - [[#usage][Usage]]\n  - [[#emacslsplsp-docker-langservers][emacslsp/lsp-docker-langservers]]\n    - [[#configuration][Configuration]]\n    - [[#how-it-works][How it works]]\n  - [[#emacslsplsp-docker-full][emacslsp/lsp-docker-full]]\n    - [[#flags][Flags]]\n      - [[#emacs][Emacs]]\n      - [[#spacemacs][Spacemacs]]\n  - [[#custom-language-server-containers][Custom language server containers]]\n    - [[#building-a-container-or-an-image-manually][Building a container (or an image) manually:]]\n    - [[#registering-a-language-server-using-a-persistent-configuration-file][Registering a language server using a persistent configuration file:]]\n    - [[#registering-a-language-server-using-a-dir-locals-file][Registering a language server using a =.dir-locals= file:]]\n    - [[#automatic-image-building][Automatic image building:]]\n  - [[#docker-over-tramp-tbd][Docker over TRAMP (TBD)]]\n  - [[#see-also][See also]]\n  - [[#maintainers][Maintainers]]\n\n** Preconfigured language servers\n   =emacslsp/lsp-docker-langservers= has the following content:\n   - Language servers:\n     | Language              | Language Server                   |\n     |-----------------------+-----------------------------------|\n     | Bash                  | [[https://github.com/mads-hartmann/bash-language-server][bash-language-server]]              |\n     | C++                   | [[https://github.com/MaskRay/ccls][ccls]]                              |\n     | CSS/LessCSS/SASS/SCSS | [[https://github.com/vscode-langservers/vscode-css-languageserver-bin][css]]                               |\n     | Dockerfile            | [[https://github.com/rcjsuen/dockerfile-language-server-nodejs][dockerfile-language-server-nodejs]] |\n     | Go                    | [[https://golang.org/x/tools/cmd/gopls][gopls]]                             |\n     | HTML                  | [[https://github.com/vscode-langservers/vscode-html-languageserver][html]]                              |\n     | JavaScript/TypeScript | [[https://github.com/theia-ide/typescript-language-server][typescript-language-server]]        |\n     | Python                | [[https://github.com/python-lsp/python-lsp-server][pylsp]]                             |\n** Usage\n   There are two ways of working with containerized language servers:\n   - 2 containers provided by =lsp-docker=:\n      - [[#emacslsplsp-docker-langservers][emacslsp/lsp-docker-langservers]]\n      - [[#emacslsplsp-docker-full][emacslsp/lsp-docker-full]]\n   - [[#custom-language-server-containers][Custom language server containers]]\n\n** emacslsp/lsp-docker-langservers\n   This container is used by =lsp-docker= to run =Language Servers= for =lsp-mode= over local sources.\n   =You must pull the container before lsp-docker can use it=\n*** Configuration\n    - Clone the repo\n      #+begin_src bash\n      git clone https://github.com/emacs-lsp/lsp-docker\n      #+end_src\n    - Pull the container\n      #+begin_src bash\n      docker pull emacslsp/lsp-docker-langservers\n      #+end_src\n    - Add repo to load path and register the docker clients in your =~/.emacs= file\n      #+begin_src elisp\n      ;; Uncomment the next line if you are using this from source\n      ;; (add-to-list 'load-path \"\u003cpath-to-lsp-docker-dir\u003e\")\n      (require 'lsp-docker)\n\n      (defvar lsp-docker-client-packages\n          '(lsp-css lsp-clients lsp-bash lsp-go lsp-pylsp lsp-html lsp-typescript\n            lsp-terraform lsp-clangd))\n\n      (setq lsp-docker-client-configs\n          '((:server-id bash-ls :docker-server-id bashls-docker :server-command \"bash-language-server start\")\n            (:server-id clangd :docker-server-id clangd-docker :server-command \"clangd\")\n            (:server-id css-ls :docker-server-id cssls-docker :server-command \"css-languageserver --stdio\")\n            (:server-id dockerfile-ls :docker-server-id dockerfilels-docker :server-command \"docker-langserver --stdio\")\n            (:server-id gopls :docker-server-id gopls-docker :server-command \"gopls\")\n            (:server-id html-ls :docker-server-id htmls-docker :server-command \"html-languageserver --stdio\")\n            (:server-id pylsp :docker-server-id pyls-docker :server-command \"pylsp\")\n            (:server-id ts-ls :docker-server-id tsls-docker :server-command \"typescript-language-server --stdio\")))\n\n      (require 'lsp-docker)\n      (lsp-docker-init-clients\n        :path-mappings '((\"path-to-projects-you-want-to-use\" . \"/projects\"))\n        :client-packages lsp-docker-client-packages\n        :client-configs lsp-docker-client-configs)\n      #+end_src\n*** How it works\n    =lsp-mode= starts the image passed as =:docker-image-id= and mounts =:path-mappings= in the container. Then when the process is started =lsp-mode= translates the local paths to =docker= path and vice versa using the =:path-mappings= specified when calling =lsp-docker-init-default-clients=. You may use =lsp-enabled-clients= and =lsp-disabled-clients= to control what language server will be used to run for a particular project(refer to =lsp-mode= FAQ on how to configure .dir-locals).\n\n** emacslsp/lsp-docker-full\n    The container =emacslsp/lsp-docker-full= contains:\n    - The above language servers\n    - =Emacs28= compiled with native JSON support for better performance.\n*** Flags\n    | Flag            | Purpose                                | Default                                               |\n    |-----------------+----------------------------------------+-------------------------------------------------------|\n    | EMACS_D_VOLUME  | Emacs folder to use for =/root/.emacs= | Emacs: =$(pwd)/emacs.d= Spacemacs: =$(pwd)/spacemacs= |\n    | PROJECTS_VOLUME | Directory to mount at /Projects        | =$(pwd)/demo-projects/=                               |\n    | TZ              | Timezone to user in container          | Europe/Minsk                                          |\n    | DOCKER_FLAGS    | Any additional docker flags            | N/A                                                   |\n**** Emacs\n     - Clone =lsp-docker=.\n       #+begin_src bash\n       git clone https://github.com/emacs-lsp/lsp-docker\n       cd lsp-docker\n       #+end_src\n     - Run\n       #+begin_src bash\n       bash start-emacs.sh\n       #+end_src\n**** Spacemacs\n     - Clone =lsp-docker=.\n       #+begin_src bash\n       git clone https://github.com/emacs-lsp/lsp-docker\n       cd lsp-docker\n       #+end_src\n     - Clone spacemacs repo\n       #+begin_src bash\n       # Clone spacemacs develop\n       git clone -b develop https://github.com/syl20bnr/spacemacs spacemacs\n       #+end_src\n     - Run\n       #+begin_src bash\n       EMACS_D_VOLUME=/path/to/spacemacs bash start-spacemacs.sh\n       #+end_src\n\n** Custom language server containers\n   You can use manually built language containers or images hosting language server(s), just follow a few simple rules (shown below).\n   The docker images may feature an optional tag, if omitted _latest_ will be assumed.\n\n*** Building a container (or an image) manually:\n    You have 2 constraints:\n    - A language server must be launched in =stdio= mode (other types of communication are yet to be supported)\n    - A docker container (only =container= subtype, see the configuration below) must have your language server as an entrypoint (basically you have to be able to launch it with =docker start -i \u003ccontainer_name\u003e= as it is launched this way with =lsp-docker=)\n\n    When you have sucessfully built a language server, you have to register it with either a configuration file or a =.dir-locals= file.\n\n*** Registering a language server using a persistent configuration file:\n    A configuration file is a yaml file that can be located at:\n#+begin_src\n\u003cPROJECT_ROOT\u003e/.lsp-docker.yml\n\u003cPROJECT_ROOT\u003e/.lsp-docker.yaml\n\u003cPROJECT_ROOT\u003e/.lsp-docker/.lsp-docker.yml\n\u003cPROJECT_ROOT\u003e/.lsp-docker/.lsp-docker.yaml\n\u003cPROJECT_ROOT\u003e/.lsp-docker/lsp-docker.yml\n\u003cPROJECT_ROOT\u003e/.lsp-docker/lsp-docker.yaml\n\u003cPROJECT_ROOT\u003e/.lsp-docker/config.yml\n\u003cPROJECT_ROOT\u003e/.lsp-docker/config.yaml\n#+end_src\n\nIt is structured in the following way:\n\n#+begin_src yaml\n  # single server configuration\n  lsp:\n    server:\n      type: docker\n      # subtype:\n      # - \"container\": attach to an already running container\n      # - \"image\": when image does not exist, try to build it based on the dockerfile found in the project-scope\n      #   (see Automatic image building). An image might feature an optional tag, i.e. '\u003cimage\u003e:\u003ctag\u003e'. If a\n      #   tagless image is indicated 'latest' will be assumed.\n      subtype: container\n      # Image/container name to use for this language server.\n      name: image-container-name\n      # server id of a registered LSP server. You can find the list of registered servers evaluating:\n      #\n      # `(ht-keys lsp-clients)`\n      #\n      # source:\n      # https://stackoverflow.com/questions/17066169/retrieve-keys-from-hash-table-sorted-by-the-values-efficiently\n      server: server-id-of-the-base-server\n      # an (optional) array of parameters (docker or podman) to launch the image with\n      # initially intended to host the '--userns' parameter\n      # NOTE: 'launch_parameters' are not used with 'container' subtype servers\n      # in this case embed all required parameters when creating the server instead\n      launch_parameters:\n        - \"--userns=nomap\"\n      # command to launch the language server in stdio mode\n      # NOTE: 'launch_command' is not used with 'container' subtype servers as a command is embedded in a\n      # container itself and serves as entrypoint\n      launch_command: \"launch command with arguments\"\n    mappings:\n      # NOTE: the paths must be within the project this server is being build for\n      - source: \"/your/host/source/path\"\n        destination: \"/your/path/inside/the/container\"\n\n  # multiple server configuration\n  lsp:\n    server:\n      - type: ...\n        subtype: ...\n        ...                       # keys as in the classic single server case, e.g. type, subtype, etc...\n      - ...                       # other single server configuration(s)\n    mappings:                     # shared among all servers\n      - source: \u003cpath-on-host\u003e\n        destination: \u003cpath-on-lang-server\u003e\n      ...                         # other mappings\n#+end_src\n\n*** Registering a language server using a =.dir-locals= file:\n    Just refer to the source code and general conventions of using =.dir-locals=. The variable you need is =lsp-docker-persistent-default-config=, its content is merged with the =lsp= section from a configuration file (if present).\n\n*** Automatic image building:\n    You can also build an image automatically (currently supported only for =image= subtype): just drop the corresponding =Dockerfile= into the =.lsp-docker= folder in the project root (=Dockerfile= may be named as =Dockerfile= or =Dockerfile.lsp=). Building process is triggered by the =lsp-docker-register= call (you will be prompted whether you want to build the image). Image building *takes place in the project root* (*not* in the =.lsp-docker= subfolder)! In case of an automatic build the image will be registered automatically (based on the values from the config or =.dir-locals= file).\n\n    You can also troubleshoot any issues with supplemental docker calls (checking whether the required image already exists, building a new image) using the supplemental logging functionality: there are 2 variables: first you have to set =lsp-docker-log-docker-supplemental-calls= to true-like value (by default it is =nil=) and then specify the log buffer in the =lsp-docker-log-docker-supplemental-calls-buffer-name= variable (by default it is set to =*lsp-docker-supplemental-calls*=)\n\n** Docker over TRAMP (TBD)\n   Docker running the language servers and hosting the sources, Emacs running on the desktop machine and connecting to docker instance over TRAMP.\n** See also\n   - [[https://github.com/Silex/docker.el][docker]] - package for managing =docker= images/containers.\n** Maintainers\n   - [[https://github.com/yyoncho][yyoncho]]\n   - [[https://github.com/rnikoopour][rnikoopour]]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femacs-lsp%2Flsp-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femacs-lsp%2Flsp-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femacs-lsp%2Flsp-docker/lists"}