The Easiest way to install Docker Engine on a Linux Server

Photo by Ian Taylor on Unsplash

The Easiest way to install Docker Engine on a Linux Server

This is only recommended if you're learning or using Docker in non-prod environments.

If you're working on a local machine, you can easily download and install Docker Desktop for your operating system - Windows, Mac or even Linux Desktops these days.

However, if you're someone like me who does most of the work on the Cloud, or to be specific, remote environments, this may not be the right choice for you.

A man screaming "IT IS IN THE CLOUD". It's a meme, fellas.

Something that I discovered pretty late is that Docker, for quite some time, has had a super fast solution to install Docker Engine in Linux environments.

Screenshot of the website

If you check the website, you will find out that Docker maintains a script to install Docker Engine on Linux.

As they mentioned, this method is not intended for production environments, which I assume anyway will be working with a specific Docker version.

The best part about this script is that you need absolutely no package managers to work with.

Installing Docker using the Script

# Download the script
curl -fsSL -o

# Run the script as it tries to figure out the type of Linux
# distribution it's dealing with and installs the latest CLI and Engine versions
sudo sh

Simply running these two commands will install the latest version of the Docker Engine, its CLI and a few other tools/plugins like Compose, Buildx, etc.

Run Docker without Root access

Screenshot of the Permission Denied Error when you run docker commands without root access

Now, if you run any docker command after installing, you'll probably come across a similar error. The quick solution to this is to run the same commands with sudo, but it has been fairly annoying to me. But there's also a quick 1-command fix to this.

sudo usermod -aG docker <USERNAME>
sudo reboot

Screenshot of a working docker container ls command

The flags a and G in the command are to add the user to a group, and just by running the command and rebooting your system, you can run docker commands without root access. Even though this requires one-time super-user access, I feel that it's definitely time-saving.

Thanks for reading, I hope you have a good day ahead :)

Did you find this article valuable?

Support Sreekesh Iyer by becoming a sponsor. Any amount is appreciated!