spacemacs/layers/+tools/docker/README.org

92 lines
3.6 KiB
Org Mode
Raw Normal View History

2016-06-10 03:53:33 +00:00
#+TITLE: Docker layer
2019-05-02 21:49:30 +00:00
#+TAGS: layer|tool
[[file:img/docker.png]]
2019-05-07 20:05:06 +00:00
* Table of Contents :TOC_5_gh:noexport:
2017-05-22 14:16:12 +00:00
- [[#description][Description]]
- [[#features][Features:]]
2017-05-22 14:16:12 +00:00
- [[#install][Install]]
2019-11-10 05:53:44 +00:00
- [[#docker][Docker]]
- [[#linting][Linting]]
- [[#lsp][LSP]]
- [[#options][Options]]
2017-05-22 14:16:12 +00:00
- [[#usage][Usage]]
- [[#tramp-access-to-docker-containers][TRAMP access to docker containers]]
- [[#key-bindings][Key bindings]]
* 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 [[https://github.com/Silex/docker.el][docker.el]]
- =docker-compose= integration via [[https://github.com/Silex/docker.el][docker.el]]
- Syntax checking via [[https://github.com/hadolint/hadolint][hadolint]]
* Install
2019-11-10 05:53:44 +00:00
** 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 [[https://www.docker.com/][Docker]] for the actual container management.
2019-11-10 05:53:44 +00:00
** Linting
For syntax checking the external library [[https://github.com/hadolint/hadolint][hadolint]] is necessary.
** LSP
This layer can be used with [[https://github.com/rcjsuen/dockerfile-language-server-nodejs][=dockerfile-language-server-nodejs=]] and emacs
[[https://github.com/emacs-lsp/lsp-mode][=lsp-mode=]] to provide richer, IDE-like capabilities.
To use this layer with lsp, you must do the following:
1. Add =lsp= to =dotspacemacs-configuration-layers=.
2. Install =dockerfile-language-server-nodejs= package with:
#+BEGIN_SRC sh
npm i -g dockerfile-language-server-nodejs
#+END_SRC
3. Enable layer integration with lsp as described in section below.
* Options
This layer also includes experimental support for =lsp-mode=. To enable language
server functionality with this layer, follow [[#lsp][the instructions for installation]],
and then install this layer with:
#+BEGIN_SRC emacs-lisp
(setq-default dotspacemacs-configuration-layers
'((docker :variables docker-dockerfile-backend 'lsp)))
#+END_SRC
2016-06-10 03:53:33 +00:00
* Usage
** TRAMP access to docker containers
This relies on the [[https://github.com/emacs-pe/docker-tramp.el][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 m c b~ | build current buffer |
| ~SPC m c B~ | build current buffer without cache |
| ~SPC a D c~ | list docker containers |
| ~SPC a D C~ | docker-compose commands for current project |
| ~SPC a D d~ | delete image |
| ~SPC a D e~ | unpause container |
| ~SPC a D F~ | pull image |
| ~SPC a D i~ | list docker images |
| ~SPC a D k~ | delete container |
| ~SPC a D o~ | stop container |
| ~SPC a D p~ | pause container |
| ~SPC a D P~ | push image |
| ~SPC a D r~ | restart container |
| ~SPC a D s~ | start container |