LazyDocker is an amazingly useful command line utility for managing Docker applications / services. The interface is generated completely int he CLI (command line interface) so it's available with a simple SSH login to the host server. It's cross platform, so you can install LazyDocker on Windows, MacOS, and Linux based systems. Last, but certainly not least, the design allows you to navigate and take actions with either the mouse, or keyboard shortcuts.
I get the occasional comment on my videos from folks who have a real distaste for Docker as an application platform. I completely understand why that is. The docker team, on their own website, tout it as a developer tool much more than a production service tool. The truth of the matter is - it's both.
I'm with you guys, I swear it. I'm the guy who heard about docker back in 2014, and even after looking into it, just didn't get ti. It was almost 2020 before I really started to see the value in running applications in Docker. It was because of my channel, and my desire to show how Open Source has embraced Docker, and how using Docker is an intelligent, sustainable way to expose more people, on more platforms, the power of open source software.
I've Heard it, and I'll Debunk it
Docker is a black box, and I don't know what's going on inside it.
You can't troubleshoot applications running in Docker.
I just want to run the application on my host server, why don't they tell me how to do that?
Two of these can be answered with a single word - Dockerfile.
Every Docker image is created using a Dockerfile. It's the file that docker reads in order to know how to build the application and make it run. It's essentially a script that tells docker
- what base system to start with,
- what dependencies to install,
- what versions of supporting software to use / install,
- which environment variables to set, and what they should be by default
- what ports to expose, and what they should be mapped as from host to container
- what command to use to start the server
All of the things you want to know, in order to run the application on your host system. All the things you want to know Docker is doing in the background is right there in the Dockerfile.
You Can Troubleshoot Inside a Docker Container
You may need some tools to help with it, but there is absolutely the ability to get into a docker container and do your IT thang!
Tools for helping to manage Docker
- Portainer - https://portainer.io
- Yacht - https://github.com/SelfhostedPro/Yacht
- Dyrector.io - https://github.com/dyrector-io/dyrectorio
- LaxyDocker - https://github.com/jesseduffield/lazydocker
I've covered Portainer, an awesome, powerful browser based application for deploying, managing, troubleshooting, and keeping your docker system clean in the past. I've also covered Yacht, a newer option, but one that is getting better and more powerful by the day. I plan to cover Dyrector.io in the future, but today I want to focus on the LazyDocker option.
This powerful little CLI application is just what the doctor ordered when it comes to getting down and dirty with the docker world.
The interface is simple, clean, and easily navigable using keyboard and / or mouse controls. It gives you a lot of really useful information at a glance, and provides easy ways to jump into your docker containers, and start digging around, modifying, troubleshooting, and more.
Installation of LazyDocker
As always, I'm going to first state that if you are finding this tutorial more than a couple of months after it's been posted (March 2023), please go to the lazydocker github page, and verify that the installation methods I'm providing are still valid and correct. There is nothing better than the original source. All of my information on install methods are pulled from their page.
That said, I'm targeting all of you with this tutorial. For those on MacOS, the folks at LazyDocker have chosen to use a package management system called Homebrew. This is a bit like package managers for the *nix systems. You provide a simple command in the CLI (terminal app), and Homebrew uses that to install all of the necessary dependencies.
You will, of course, first need to install Homebrew if you don't already have it. So, jump over to the Homebrew main page, and grab their command for installation. For the sake of simplicity, here is the command as it's shown at the time of writing this article:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Assuming all went well, you'll now be able to run the Homebrew command to install LazyDocker on your Mac. Here's the command as it is at the time of writing this article:
brew install jesseduffield/lazydocker/lazydocker
So you say you run an OS called Windows? Never heard of it...but if you do happen to run this odd, almost never heard of OS, then you'll need a package manager as well. There are apparently two to choose from. Once is called Scoop, and the other is called Chocolatey. Indeed...the Windows makers seemed to be desiring ice cream at the time they named these tools.
For Scoop, I recommend, again, jumping over to their homepage to get the latest installation instructions. But for the sake of simplicity, this is what they say to do at the time of writing this article:
In Powershell (yes Powershell)... and I would imagine you need to run this as an administrator of the system... run the following two commands:
> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser # Optional: Needed to run a remote script the first time
> irm get.scoop.sh | iex
Now you can use Scoop to install LazyDocker with (again at the time of writing this article):
scoop install lazydocker
If you prefer to use Chocolatey...and who wouldn't with a delicious name like that...then you'll need to first install the Chocolatey package manager on your Windows system. Not being a Windows user, I'm going to leave this one up to you...but here is a link to the Chocolatey Homepage, where you can find the information for installation.
Once you've installed Chocolatey, the command to install LazyDocker (at the time of writing this article) is simply:
choco install lazydocker
Now, that is simplicity at it's finest.
For the rest of us, using the most popular kernel in the world...there are a multitude of ways to install LazyDocker. I'll one last time, refer you to the LazyDocker GitHub Page to look through their installation instructions...but for simplicity, I'll post their current script here. You should always first open a script, and make sure it looks fine before running it with a piped command...but you all know this already.
- Check the script. Click this link to open the raw github script as it is at the time of writing this article.
- Run the install command in your shell (terminal / cli) only after you have checked the script and are comfortable with it:
curl https://raw.githubusercontent.com/jesseduffield/lazydocker/master/scripts/install_update_linux.sh | bash
Once the install of your choice has completed, you can now run LazyDocker in the Powershell, Terminal, CLI of your liking using the command:
When it opens, you'll notice a fairly simple, clean interface. The left side is broken into sections vertically, while the right side is one large section set to display the detail of whatever you select from the left.
The right side has tabs (based on the section you are in on the left) that you can move through using the mouse, or keyboard shortcuts.
You can arrow up and down on the left, through the various containers, as well as tab through the various sections. To really get a handle on all of the keyboard shortcuts press the 'x' key. Take note of the shortcuts, and then press 'Esc' to exit the menu. Try out the various shortcuts, and as you get more used to them, you'll realize just how powerfull the LazyDocker tool really is.
I Don't Like Docker - It's a black box / I Can't Get Into Docker to Troubleshoot
I've heard this, and it's not. We've discussed the Dockerfile, which allows you to know how the container is built, and what's going on inside of it. But there's also the ability to get into the container in the CLI and actually do all of your normal cli bash / sh commands to work on the container. The one thing to keep in mind, is that any changes you make must be tied to a mapped volume. If not, on the next container stop / start / restart / update, you'll likely lose those changes.
So, from LazyDocker, hightlight the container you want to jump into then press the 'Shift + E' key, and you'll be put into the shell for that container. Go wild. You're ready to do all your IT goodness in this container now.
While I'm having a bit of fun with this article, I truly do hope that it will help those of you who are less familiar with Docker, and / or containerization as a whole, become more familiar with the power of containers. Instead of following some 3 year old blog about how to install a piece of software, that was written on a version 6 versions back, and trying to get all the configuration right; containers allow the developers of the software to configure it as they intended up front. You are given the application / service as it was meant to be setup, and you may simply need to supply some specifics to your setup (domain name, IP ranges, timezone, etc). But the application should run well, and be setup to run as it was intended from the start. What an incredible leap forward in how we deploy applications and services.
Support My Content
Support my Channel and ongoing efforts through Patreon: