NicolasPetton/pass@919d8e3 -> NicolasPetton/pass@a095d24 abo-abo/define-word@3af6825 -> abo-abo/define-word@6e4a427 editorconfig/editorconfig-emacs@da84471 -> editorconfig/editorconfig-emacs@d73333c emacs-lsp/dap-mode@041db8e -> emacs-lsp/dap-mode@612388d emacs-lsp/lsp-mode@61443f3 -> emacs-lsp/lsp-mode@dbfbe1a emacs-lsp/lsp-ui@49bc513 -> emacs-lsp/lsp-ui@94673cd emacs-straight/project@0003fe4 -> emacs-straight/project@a1997af emacsorphanage/terraform-mode@63fafc6 -> emacsorphanage/terraform-mode@a9fa5bd joaotavora/eglot@2172641 -> joaotavora/eglot@4c85df2 k1LoW/emacs-ansible@cf6b8f0 -> k1LoW/emacs-ansible@40af0d2 magit/forge@953764d -> magit/forge@e340c2b magit/magit@acfe22a -> magit/magit@2145477 millejoh/emacs-ipython-notebook@a019ee3 -> millejoh/emacs-ipython-notebook@917f2a0 nicolaisingh/saveplace-pdf-view@88e07be -> nicolaisingh/saveplace-pdf-view@b037091 realgud/realgud@ff66001 -> realgud/realgud@f73c039 spotify/dockerfile-mode@d31f768 -> spotify/dockerfile-mode@6a56c1c tmalsburg/helm-bibtex@8d84d8b -> tmalsburg/helm-bibtex@1bb81d7 tmalsburg/helm-bibtex@8d84d8b -> tmalsburg/helm-bibtex@1bb81d7 tmalsburg/helm-bibtex@8d84d8b -> tmalsburg/helm-bibtex@1bb81d7 tumashu/posframe@e1552c8 -> tumashu/posframe@ae8ac91
tools/docker
Description
This module allows you to manipulate Docker images, containers & more from Emacs.
Provides a major dockerfile-mode
to edit Dockerfiles
. Additional
convenience functions allow images to be built easily.
docker-tramp.el
offers a TRAMP method for Docker containers.
Module Flags
+lsp
Enables integration for the Dockerfile Language Server.
Plugins
Prerequisites
This module assumes docker
, docker-compose
and docker-machine
binaries
are installed and accessible from your PATH.
Optionally, this module also uses the following programs:
docker-langserver
(for LSP users):npm install -g dockerfile-language-server-nodejs
Features
Docker control
Use M-x docker
, select a resource, and then mark or unmark items using the
following keybindings (for more marking possibilities, check out
https://github.com/politza/tablist):
Binding | Description |
---|---|
? |
List actions |
l |
Configure listing |
m |
Mark item |
u |
Unmark item |
t |
Toggle marks |
U |
Unmark all |
s |
Sort |
* r |
Mark items by regexp |
< |
Shrink column |
> |
Enlarge column |
C-c C-e |
Export to csv |
Supported commands
docker container
:attach
,cp
,diff
,inspect
,kill
,logs
,pause
,rename
,restart
,rm
,start
,stop
,unpause
docker image
:inspect
,pull
,push
,rm
,run
,tag
docker network
:rm
docker volume
:rm
docker-machine
:create
,env
,restart
,rm
,start
,stop
docker-compose
:build
,config
,create
,down
,exec
,logs
,pull
,push
,remove
,restart
,run
,start
,stop
,up
You can also enterdired
or open a file inside a container or volume.
TRAMP
Offers the TRAMP method docker
to access running containers.
C-x C-f /docker:user@container:/path/to/file
user |
the user that you want to use (optional) |
container |
the id or name of the container |
Configuration
Popups
Thanks to magit-popup, all the popups default arguments can be customized. For
example, here is how to customize the arguments for docker-image-run-popup
:
(setq docker-image-run-arguments '("-i" "-t" "--rm"))
or inside a use-package
declaration:
(use-package! docker
:bind ("C-c d" . docker)
:custom (docker-image-run-arguments '("-i" "-t" "--rm")))
You can also customize these using M-x customize-variable
.
Other useful variables
Variable | Description | Default |
---|---|---|
docker-command |
The docker binary to use | docker |
docker-container-default-sort-key |
Sort key for docker containers | ("Image") |
docker-container-shell-file-name |
Shell to use when entering containers | /bin/bash |
docker-image-default-sort-key |
Sort key for docker images | ("Repository") |
docker-machine-default-sort-key |
Sort key for docker machines | ("Name") |
docker-network-default-sort-key |
Sort key for docker networks | ("Name") |
docker-run-as-root |
Run docker as root | nil |
docker-volume-default-sort-key |
Sort key for docker volumes | ("Driver") |
Completion in Dockerfiles
By default, the keyword completion function detects the docker-compose
version of the current buffer and suggests the appropriate keywords.
You can change the candidates offered by the backend by customizing
docker-compose-keywords
.
Troubleshooting
Tramp hangs on Alpine container
Busyboxes built with the ENABLE_FEATURE_EDITING_ASK_TERMINAL
config option
also send escape sequences, which tramp-wait-for-output
doesn't ignore
correctly. This was fixed in TRAMP upstream and is available since TRAMP 2.3.
For older versions of TRAMP you can dump docker-tramp-compat.el in your
load-path
somewhere and add the following to your init.el
to overwrite
tramp-wait-for-output
with the patch applied:
(require 'docker-tramp-compat)