This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+tools/docker/README.org
Alfonso Montero 99eb20e13c
Docker: Followup for #15414: fix bindings not loading, add docs (#15707)
* [docker] Followup for #15414: Fix bindings not being added, add docs.

* [docker] Wrap `:config` block in a `progn`, as per CONVENTIONS.org.

* [docker] Fix key binding in documentation.

Co-authored-by: Tommi Komulainen <tkomulai+github@gmail.com>

Co-authored-by: Tommi Komulainen <tkomulai+github@gmail.com>
2022-08-27 10:42:12 +02:00

3.2 KiB

Docker layer

/TakeV/spacemacs/media/commit/99eb20e13c3b698bb8ba95ed278fb79861625f5b/layers/+tools/docker/img/docker.png

Description

This layer integrates basic container management into Spacemacs.

Features:

  • Syntax highlighting for Docker files
  • Docker build integration
  • TRAMP access to running Docker containers
  • Docker container and image management via docker.el
  • docker-compose integration via docker.el
  • Syntax checking via hadolint
  • Code-Completion via lsp

Install

Docker

To use this configuration layer, add it to your ~/.spacemacs. You will need to add docker to the existing dotspacemacs-configuration-layers list in this file.

You will also need the native package Docker for the actual container management.

Linting

For syntax checking the external library hadolint is necessary. It can either be downloaded from here or build locally with stack as shown below:

  stack install hadolint

LSP

This layer can be enhanced with dockerfile-language-server-nodejs and emacs lsp-mode to provide richer, IDE-like capabilities. To do so set the layer variable docker-dockerfile-backend to lsp like shown below:

  (setq-default dotspacemacs-configuration-layers
                '((docker :variables docker-dockerfile-backend 'lsp)))

In addition you need to install the lsp server's executable in your system. This can be done via npm:

  npm i -g dockerfile-language-server-nodejs

Usage

TRAMP access to docker containers

This relies on the docker-tramp package which uses docker exec available in docker versions > 1.3.

docker-tramp adds a new prefix /docker: that you can use with SPC f f, this prefix allows to access your docker containers and also provides auto-completion of the running containers.

Key bindings

Key binding Description
SPC a t d entry point to interact with dockers, after that use ? for help
SPC m b build current buffer
SPC m B build current buffer without cache
SPC m d shortcut for docker.el main menu
SPC m i shortcut for 'docker images' in the docker.el screen
SPC m p shortcut for 'docker containers' in the docker.el screen