While Docker is an incredibly powerful tool, setting it up on Ubuntu can sometimes be a complex affair. But fear not! In this post, we'll go through the steps of installing Docker (and Docker Compose) on Ubuntu using a convenient script.
Before we begin the installation process, ensure that you are running on Ubuntu. The steps provided in this guide are written for Ubuntu, but could be applicable to other distributions with some modifications.
TL;DR:
wget https://gist.githubusercontent.com/welel/f80c96482e3b539487b9fa08bfcab86d/raw/90bc2330924d225aef7dc3178f5926bda7daff04/install_docker.sh
sudo chmod +x install_docker.sh
sudo ./install_docker.sh
Here's how to install Docker using a script on Ubuntu:
Step 1: Download the Installation Script
First, you need to download the script that automates the installation process. Open your terminal and enter the following command:
wget https://gist.githubusercontent.com/welel/f80c96482e3b539487b9fa08bfcab86d/raw/90bc2330924d225aef7dc3178f5926bda7daff04/install_docker.sh
This command fetches the necessary script from a Gist and saves it to your current directory.
The script available on Gist. The Gist includes both the script itself and a detailed explanation of its usage. You can view and download the script, as well as find instructions on how to use it, at the following link:
Install Docker on Ubuntu - Installation Script and Guide
This resource makes the installation process straightforward and clear, allowing you to get Docker up and running on your Ubuntu system with minimal fuss.
Step 2: Give the Script Execution Permissions
Before you can run the script, you need to give it permission to execute. Change the permissions with the chmod
command:
sudo chmod +x install_docker.sh
Step 3: Execute the Script
Now it's time to run the script. You’ll do this with elevated privileges using sudo
:
sudo ./install_docker.sh
Once you have executed the script, keep an eye on the terminal output. If everything goes according to plan, you should see a message stating Docker successfully installed. This confirmation signifies that Docker has been successfully installed on your system, and you're ready to start using it for your containerization needs.
Post-Installation
To ensure that it's working correctly, you can run:
docker --version
docker compose version
This command should output the version of Docker that you've just installed and Docker Compose version.
Furthermore, it's a good practice to add your user to the docker
group, so you can execute Docker commands without using sudo
:
sudo usermod -aG docker ${USER}
Remember to log out and log back in for this change to take effect.
With the above script, installing Docker on Ubuntu is almost as easy as pie. Remember to check the Docker documentation for more details on how to use Docker and its myriad of features. Happy Dockering!
Top comments (0)