Installing Docker Engine on Ubuntu 24.04: A Step-by-Step Guide
In this tutorial, we will guide you through the process of installing Docker Engine on Ubuntu 24.04 LTS, a reliable Linux SSD VPS platform like Shape.Host. This guide is optimized for Cloud VPS users, ensuring you get the latest stable version of Docker tailored for Ubuntu 24.04 LTS with support for both amd64 and arm64 architectures.
**Step 1: Update Your System** Begin by updating your package lists to ensure you have the latest information on available packages: ```bash sudo apt update sudo apt upgrade -y ```
**Step 2: Install Necessary Helper Packages** These packages allow your system to use repositories over HTTPS and to manage software properties easily: ```bash sudo apt install apt-transport-https ca-certificates curl software-properties-common ```
**Step 3: Add Docker’s Official GPG Key** This step ensures the authenticity of packages from Docker’s repository: ```bash curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg ```
**Step 4: Set Up the Docker Repository** Configure your system to use Docker’s official repository: ```bash echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null ```
**Step 5: Update Package Cache Again** Refresh your package index to include Docker’s repository: ```bash sudo apt update ```
**Step 6: Install Docker Engine and Related Components** Install the Docker engine, CLI, containerd runtime, and Docker Compose plugin all at once: ```bash sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin ```
**Step 7: (Optional) Manage Docker as a Non-root User** To avoid typing `sudo` with every Docker command, add your user to the Docker group: ```bash sudo usermod -aG docker $USER ``` Then log out and back in or reboot for this to take effect.
**Step 8: Verify Docker Installation** Confirm Docker is installed and running with: ```bash docker --version sudo systemctl status docker ```
This installation approach uses the official Docker repository, which is preferred over Ubuntu’s default packages to get more recent releases and better support. If you want to start using Docker Compose v2, it's installed along with the Docker Engine package as the Docker Compose plugin, simplifying container orchestration without separate installation steps.
For Windows users, they can use the built-in Windows Terminal or PowerShell, or install PuTTY to connect. After updating the package index again, Docker Engine, CLI, and support tools are installed. A keyrings directory is created to store the Docker GPG key. The port for connection is 22, and the connection type is SSH.
The IP address of the instance can be found in the Resources section. A test container can be run to confirm Docker is functioning properly. If Docker needs to be uninstalled, the command "sudo apt-get purge docker-ce" can be used, followed by deleting Docker’s data with "sudo rm -rf /var/lib/docker". To update the package index, run the command "sudo apt-get update" after logging in.
To connect to a VPS on Linux or macOS, open a terminal and replace the IP address with the actual IP address of the Shape.Host instance. Users can deploy their own server at Shape.Host. Proper permissions for the GPG Key are set to allow the APT system to read the key. Installing required dependencies is necessary for adding Docker's GPG key and repository.
In the realm of smart-home devices, one might find gadgets incorporating advanced technology in their operations, much like the Docker Engine installed in this tutorial which leverages cutting-edge technology for container orchestration. As we progressed through the installation process, we added necessary helper packages to ease the system's management of software properties.