这是一个简单的基于终端的 UI 管理工具,主要适用于对 docker 和 docker-compose 容器以及服务的管理和便捷使用,灵感来自于 gocui 并使用 Go 语音改写。
1.功能特性
轻度用户使用尚可,可不要把它当做是一个专业的管理工具,哈哈哈
- 查看docker或docker-compose容器环境的状态一目了然
- 查看container/service的日志
- 查看容器指标的ascii图表,如CPU/内存等
- 自定义这些图表以测量您想要的几乎任何指标
- 直接进入到container/service上
- 重新启动/删除/重建containers/services
- 查看给定图像的祖先图层
- 修剪占用磁盘空间的容器/映像或卷
2.安装方式
安装也很方便
Homebrew
# Homebrew
brew tap jesseduffield/lazydocker
brew install lazydocker
Linux/OSX
# Binary Release (Linux/OSX)
curl https://raw.githubusercontent.com/jesseduffield/ \
lazydocker/master/scripts/install_update_linux.sh | bash
Go
# Go
# Required Go version >= 1.8
go get github.com/jesseduffield/lazydocker
Zsh
# zsh config
echo "alias lzd='lazydocker'" >> ~/.zshrc
Docker
# docker build -t lazydocker .
# docker run -it lazydocker:latest /bin/sh -l
FROM golang:alpine
WORKDIR /go/src/github.com/jesseduffield/lazydocker/
COPY ./ .
RUN CGO_ENABLED=0 GOOS=linux go build
FROM alpine:latest
RUN apk add -U git xdg-utils
WORKDIR /go/src/github.com/jesseduffield/lazydocker/
COPY --from=0 /go/src/github.com/jesseduffield/lazydocker /go/src/github.com/jesseduffield/lazydocker
COPY --from=0 /go/src/github.com/jesseduffield/lazydocker/lazydocker /bin/
RUN echo "alias gg=lazydocker" >> ~/.profile
3. 键盘绑定
快捷键使用起来更方便
Project
e: edit lazydocker config
o: open lazydocker config
[: previous tab
]: next tab
m: view logs
enter: focus main panel
Containers
[: previous tab
]: next tab
d: remove
e: Hide/Show stopped containers
s: stop
r: restart
a: attach
D: prune exited containers
m: view logs
c: run predefined custom command
enter: focus main panel
Services
d: remove containers
s: stop
r: restart
a: attach
m: view logs
[: previous tab
]: next tab
R: view restart options
c: run predefined custom command
enter: focus main panel
Images
[: previous tab
]: next tab
d: remove image
D: prune unused images
enter: focus main panel
Volumes
[: previous tab
]: next tab
d: remove volume
D: prune unused volumes
enter: focus main panel
Main
esc: return