lazydocker

lazydocker

官方网站https://github.com/jesseduffield/lazydocker
GIT地址https://github.com/jesseduffield/lazydocker
GIT Star数40801
开发语言Go
GIT信息最后更新日期2025/01/28 02:25
许可MIT
简介 一个用Go语言和gocui库编写的支持Docker和docker-compose的简单终端UI。

安装手册

Homebrew

Normally lazydocker formula can be found in the Homebrew core but we suggest you to tap our formula to get frequently updated one. It works with Linux, too.

Tap:

brew install jesseduffield/lazydocker/lazydocker

Core:

brew install lazydocker

Scoop (Windows)

You can install lazydocker using scoop:

scoop install lazydocker

Chocolatey (Windows)

You can install lazydocker using Chocolatey:

choco install lazydocker

asdf-vm

You can install asdf-lazydocker plugin using asdf-vm:

Setup (Once)

asdf plugin add lazydocker https://github.com/comdotlinux/asdf-lazydocker.git

For Install / Upgrade

asdf list all lazydocker
asdf install lazydocker latest
asdf global lazydocker latest

Binary Release (Linux/OSX/Windows)

You can manually download a binary release from the release page.

Automated install/update, don't forget to always verify what you're piping into bash:

curl https://raw.githubusercontent.com/jesseduffield/lazydocker/master/scripts/install_update_linux.sh | bash

The script installs downloaded binary to $HOME/.local/bin directory by default, but it can be changed by setting DIR environment variable.

Go

Required Go Version >= 1.19

go install github.com/jesseduffield/lazydocker@latest

Required Go version >= 1.8, <= 1.17

go get github.com/jesseduffield/lazydocker

Arch Linux AUR

You can install lazydocker using the AUR by running:

yay -S lazydocker

Docker

Docker Pulls Docker Stars Docker Automated

  1. <details><summary>Click if you have an ARM device</summary><p>
    • If you have a ARM 32 bit v6 architecture

      docker build -t lazyteam/lazydocker \
      --build-arg BASE_IMAGE_BUILDER=arm32v6/golang \
      --build-arg GOARCH=arm \
      --build-arg GOARM=6 \
      https://github.com/jesseduffield/lazydocker.git
      
    • If you have a ARM 32 bit v7 architecture

      docker build -t lazyteam/lazydocker \
      --build-arg BASE_IMAGE_BUILDER=arm32v7/golang \
      --build-arg GOARCH=arm \
      --build-arg GOARM=7 \
      https://github.com/jesseduffield/lazydocker.git
      
    • If you have a ARM 64 bit v8 architecture

      docker build -t lazyteam/lazydocker \
      --build-arg BASE_IMAGE_BUILDER=arm64v8/golang \
      --build-arg GOARCH=arm64 \
      https://github.com/jesseduffield/lazydocker.git
      
    </p></details>
  2. Run the container

    docker run --rm -it -v \
    /var/run/docker.sock:/var/run/docker.sock \
    -v /yourpath:/.config/jesseduffield/lazydocker \
    lazyteam/lazydocker
    
    • Don't forget to change /yourpath to an actual path you created to store lazydocker's config

    • You can also use this docker-compose.yml

    • You might want to create an alias, for example:

      echo "alias lzd='docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock -v /yourpath/config:/.config/jesseduffield/lazydocker lazyteam/lazydocker'" >> ~/.zshrc
      

For development, you can build the image using:

git clone https://github.com/jesseduffield/lazydocker.git
cd lazydocker
docker build -t lazyteam/lazydocker \
    --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
    --build-arg VCS_REF=`git rev-parse --short HEAD` \
    --build-arg VERSION=`git describe --abbrev=0 --tag` \
    .

If you encounter a compatibility issue with Docker bundled binary, try rebuilding the image with the build argument --build-arg DOCKER_VERSION="v$(docker -v | cut -d" " -f3 | rev | cut -c 2- | rev)" so that the bundled docker binary matches your host docker binary version.

Usage

Call lazydocker in your terminal. I personally use this a lot so I've made an alias for it like so:

echo "alias lzd='lazydocker'" >> ~/.zshrc

(you can substitute .zshrc for whatever rc file you're using)

  • Basic video tutorial here.
  • List of keybindings here.

Cool features

everything is one keypress away (or one click away! Mouse support FTW):

  • viewing the state of your docker or docker-compose container environment at a glance
  • viewing logs for a container/service
  • viewing ascii graphs of your containers' metrics so that you can not only feel but also look like a developer
  • customising those graphs to measure nearly any metric you want
  • attaching to a container/service
  • restarting/removing/rebuilding containers/services
  • viewing the ancestor layers of a given image
  • pruning containers, images, or volumes that are hogging up disk space