From WikEmacs
Jump to navigation Jump to search

In the emacs world we have some packages to work with Docker.

Syntax highlighting

This is possible with dockerfile-mode (in MELPA). It also offers the ability to build the image directly (C-c C-b) from the buffer.

Manipulating images and containers

For that you'll want docker.el (in MELPA too). It defines a docker-images major mode to manipulate docker images: call it with M-x docker-images. You can first select images you want to work on with keys similar to Dired:

  • mark,
  • unmark,
  • toggle marks,
  • Unmark all.

Then you can apply actions on them:

  • Delete,
  • Fetch (pull),
  • Run,
  • Push

When you press one of these keys you'll be presented with an interactive interface à la Magit.

It works the same for containers: M-x docker-containers, see the documentation.

We can also manipulate images and containers programmatically with the functions provided that form an API.