In this quick guide, we will be walking you through the very simple steps to installing Docker on Linux.
Docker is a set of tools that provides your system with OS-level virtualization. It uses this virtualization to run software packages called containers.
Containers are completely self-contained. Software running within these containers can only access the files that you hand to it. This can help significantly with system security and resource management. For example, cleaning up software you no longer need simply requires you to delete that container; you don’t have to worry about any additional packages sitting on your system.
The biggest breakthrough with Docker is that it makes managing containerized software easy while maintaining a relatively low overhead.
You can use Docker to easily self-host numerous things, such as web software like Pi-Hole and Immich or a game server like Palworld or Minecraft.
The following guide on installing Docker is intended as a generic guide for all Linux-based operating systems. We have specific guides for the Raspberry Pi and for the Ubuntu operating system.
Installing Docker on Linux
In this section, we will show you the very simple steps to installing Docker on Linux. All you really need is a system that supports virtualization and access to the terminal.
1. We will use the official Docker install script to make installing Docker on your Linux system super easy and straightforward.
This script handles basically everything for us, it will detect your operating system and install everything as expected for that particular system.
All you need to do to install Docker is to run the following command within the terminal. This command will use curl to grab the Docker install script and pass it directly to the terminal.
curl -sSL https://get.docker.com | sh
You will be asked during the initial installation steps to enter the password for your account. Docker needs superuser privileges when setting up for the first time.
2. Once Docker has been installed to your Linux system, you will likely want to add your current user to the Docker group.
Adding a user to this group will allow them to manage containers without needing to escalate to being a super user or changing to the Docker user itself.
To add your current user to this group, use the usermod command as shown below. By using the “$USER
” environment variable we automatically swap in your current username.
sudo usermod -aG docker $USER
3. Any changes to a user’s group won’t become interactive for said user till they restart or start a new session.
You can log out of your current user by using the following command in the terminal.
logout
Alternatively, restarting your Linux system entirely will ensure that the change takes effect.
sudo reboot
Conclusion
At this stage we hope that you have successfully installed Docker onto your Linux system.
Docker is a software that you will quickly find to be incredibly useful. It allows you to run many pieces of software with just a couple of commands.
Please feel free to leave a comment below if you have any questions or concerns about setting up Docker.
If you liked this quick guide, we recommend you explore our many Docker tutorials, or you can also check out our other Linux guides.