docker.el

January 26, 2026 ยท View on GitHub

MELPA MELPA Stable CI status

docker.el

Emacs integration for Docker!

Supports docker containers, images, volumes, networks, contexts and docker-compose.

Screenshots

List images

Images list

Image run

Image run

Installation

The recommended way to install docker.el is through MELPA.

Here is a example use-package configuration:

(use-package docker
  :ensure t
  :bind ("C-c d" . docker))

Quickstart

Use M-x docker, select a resource then mark or unmark items using the following keybindings (for more marking possibilities, check out https://github.com/politza/tablist):

BindingDescription
?List actions
lConfigure listing
mMark item
uUnmark item
tToggle marks
UUnmark all
sSort
* rMark items by regexp
<Shrink column
>Enlarge column
C-c C-eExport to csv

Then select an action and follow the instructions.

Supported commands

  • docker container: attach, cp, diff, inspect, kill, logs, pause, rename, restart, rm, start, stop, unpause
  • docker image: history, inspect, pull, push, rm, run, tag
  • docker network: rm
  • docker volume: rm
  • docker context: ls, use
  • docker-compose: build, config, create, down, exec, logs, pause, pull, push, remove, restart, run, start, stop, unpause, up

You can also enter dired or open a file inside a container or volume.

Customizations

Thanks to transient, all the transients arguments can be set temporarily or permanently. See https://magit.vc/manual/transient/Saving-Values.html#Saving-Values for more information.

There are also hidden items (e.g on M-x docker where you could specify the host or TLS settings), see https://magit.vc/manual/transient/Enabling-and-Disabling-Suffixes.html for more information.

Here is a list of other customizations you can set:

VariableDescriptionDefault
docker-commandThe docker binary to usedocker
docker-compose-commandThe docker-compose binary to usedocker-compose
docker-container-columnsColumns definition for containers/bin/sh
docker-container-default-sort-keySort key for containers("Image")
docker-container-shell-file-nameShell to use when entering containers/bin/sh
docker-container-tramp-methodTramp prefix when connecting to containersdocker
docker-image-columnsColumns definition for imagesToo complex to show
docker-image-default-sort-keySort key for images("Repository")
docker-image-history-columnsColumns definition for image historyToo complex to show
docker-image-history-default-sort-keySort key for image history("Created" . t)
docker-image-run-default-argsBase arguments to use for docker run("-i" "-t" "--rm")
docker-inspect-view-modeMode used in docker inspect buffersToo complex to show
docker-network-columnsColumns definition for networksToo complex to show
docker-network-default-sort-keySort key for networks("Name")
docker-pop-to-buffer-actionAction for docker-utils-pop-to-buffernil
docker-run-as-rootRuns docker as root when enablednil
docker-terminal-backendTerminal backend for live buffersauto
docker-show-messagesIf non-nil message docker commandst
docker-show-statusWhen to compute statuslocal-only
docker-volume-columnsColumns definition for volumesToo complex to show
docker-volume-default-sort-keySort key for volumes("Driver")

Changing the default arguments for docker run

You can match on the repository name for an image to customize the initial infix arguments via docker-image-run-custom-args:

(add-to-list
   'docker-image-run-custom-args
   `("^postgres" ("-e POSTGRES_PASSWORD=postgres" . ,docker-image-run-default-args)))

So when docker run is called on an image whose repository name matches the regular expression ^postgres, the option "-e POSTGRES_PASSWORD=postgres" will appear as set along with the defaults specified by docker-image-run-default-args.

Terminal support

Commands that need a running buffer (for example docker run, docker logs, etc) use the backend selected by docker-terminal-backend. When set to auto, it prefers eat, then vterm, then shell.

Non-interactive streaming buffers (for example docker logs -f) always use a shell buffer so output can be rendered with ANSI color and kept read-only.

Contributions

They are very welcome, either as suggestions or as pull requests by opening tickets on the issue tracker.