queyenth / docker.el

Manage docker from Emacs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MELPA MELPA Stable

docker.el

Emacs integration for Docker!

Supports docker containers, images, volumes, networks 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 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

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: inspect, pull, push, rm, run, tag
  • docker network: rm
  • docker volume: rm
  • docker-compose: build, config, create, down, exec, logs, pull, push, remove, restart, run, start, stop, 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:

Variable Description Default
docker-command The binary to use docker
docker-container-columns Columns definition for containers /bin/sh
docker-container-default-sort-key Sort key for containers ("Image")
docker-container-shell-file-name Shell to use when entering containers /bin/sh
docker-image-columns Columns definition for images Too complex to show
docker-image-default-sort-key Sort key for images ("Repository")
docker-network-columns Columns definition for networks Too complex to show
docker-network-default-sort-key Sort key for networks ("Name")
docker-run-as-root Run docker as root nil
docker-run-default-args Base arguments to use for docker run ("-i" "-t" "--rm")
docker-volume-columns Columns definition for volumes Too complex to show
docker-volume-default-sort-key Sort 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-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-run-default-args.

Contributions

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

About

Manage docker from Emacs.


Languages

Language:Emacs Lisp 100.0%