A simple Emacs package to connect to nREPL servers running inside Docker containers.
- Interactively select Docker containers from the running containers list
- Remembers the last container selected for quick reconnection
- Associates specific containers with projects
- Integrates with
vertico
andmarginalia
if available - Persists container selections between Emacs sessions
- Save
docker-nrepl.el
to your Emacs load path - Add to your init file:
(require 'docker-nrepl)
(docker-nrepl-setup)
(use-package docker-nrepl
:straight (:host github :repo "eploko/docker-nrepl.el")
;; or...
;; :load-path "/path/to/docker-nrepl.el"
:after cider
:config
(docker-nrepl-setup))
(use-package docker-nrepl
:straight (:host github :repo "eploko/docker-nrepl.el")
:after cider
:config
(docker-nrepl-setup))
- Start your nREPL server in a Docker container (listening on port 7888 internally)
- Press
C-c M-c
to connect (the same keybinding ascider-connect
)- First time: You'll be prompted to select a container
- Subsequent times: Automatically connects to the last container used
- To force selection of a different container, use
C-u C-c M-c
You can associate specific Docker containers with projects:
M-x docker-nrepl-set-project-container
to associate the current project with a container- Use
C-u p C-c
(via project prefix map) to connect to the project's container
The package can be customized through the following variables:
;; Default internal port for nREPL (default: 7888)
(setq docker-nrepl-internal-port 7888)
;; File to store docker-nrepl data between Emacs sessions
(setq docker-nrepl-data-file (expand-file-name "docker-nrepl-data.el" user-emacs-directory))
;; Whether to bind the default keys
(setq docker-nrepl-bind-keys t)
Customize these before calling docker-nrepl-setup
.
Works out of the box with Vertico - gives you a nice completion interface for container selection.
If Marginalia is loaded, container annotations will be shown in the completion buffer, including:
- Container ID
- Image name
- Container status
Command | Description |
---|---|
docker-nrepl-connect |
Connect to nREPL in a Docker container |
docker-nrepl-select-container |
Select a Docker container interactively |
docker-nrepl-set-project-container |
Associate current project with a container |
docker-nrepl-connect-project |
Connect to the container for current project |
docker-nrepl-save-data |
Save container and project associations |
docker-nrepl-load-data |
Load container and project associations |
- Emacs 27.1 or later
- CIDER 1.0 or later
- Docker command-line tool available in your PATH