In this tutorial, you will learn how to install, run, test, and completely uninstall Docker on Debian 13 and other Debian-based Linux systems. This step-by-step guide covers everything from setup to professional container testing and clean removal, suitable for both beginners and experienced users. In this tutorial, you will learn how to install Docker on Debian 13, run a professional containerized application to test your setup, and completely uninstall Docker along with all its data and configuration files. Whether you are setting up a development environment or managing production systems, this step-by-step guide will help you manage Docker cleanly and [β¦]
In this tutorial, you will learn how to install, run, test, and completely uninstall Docker on Debian 13 and other Debian-based Linux systems. This step-by-step guide covers everything from setup to professional container testing and clean removal, suitable for both beginners and experienced users. In this tutorial, you will learn how to install Docker on Debian 13, run a professional containerized application to test your setup, and completely uninstall Docker along with all its data and configuration files. Whether you are setting up a development environment or managing production systems, this step-by-step guide will help you manage Docker cleanly and efficiently on Debian-based Linux distributions. Why Docker on Debian 13? Docker is the leading containerization platform, allowing you to package applications with all their dependencies into portable containers. Debian 13 is a stable, reliable Linux distribution, widely used for servers and desktops. Combining both ensures a robust environment for containerized applications. Step 1: Update System Package Index Before installing any software, it is critical to update your package index to fetch the latest available package versions and security updates. This prevents dependency issues and keeps your system secure. Run: sudo apt update Step 2: Install Prerequisite Packages Docker requires a few prerequisite packages to securely add and verify its official repository. Install these essential tools: sudo apt install -y ca-certificates curl gnupg lsb-release Step 3: Add Dockerβs Official GPG Key To ensure the authenticity of the Docker packages, add Dockerβs official GPG key. This step prevents installation of tampered or malicious packages. Execute the following commands: sudo mkdir -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg Step 4: Add Docker Repository Next, add the Docker stable repository to your systemβs package sources list. This allows apt to fetch Docker packages directly from Dockerβs official source: echo \\"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable\\" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null Step 5: Update Package List Again After adding the new repository, update the package index to include Dockerβs packages: sudo apt update Step 6: Install Docker Engine and Tools Now, install Docker Engine along with useful command-line tools and plugins: sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin Step 7: Verify Docker Installation Confirm that Docker is installed correctly by checking its version: docker --version Step 8: Run a Professional Test Container with Nginx To ensure Docker runs containers properly, letβs run the official Nginx web server container in detached mode, mapping port 8080 on the host to port 80 in the container: sudo docker run -d --name test-nginx -p 8080:80 nginx Test if the container is serving the default web page by fetching it with curl: curl http://localhost:8080 You should see the HTML content of Nginxβs default welcome page, proving that Docker is working as expected. Step 9: Manage Containers List all running containers to verify that your Nginx container is active: sudo docker ps Once confirmed, stop the running Nginx container to free system resources: sudo docker stop test-nginx Remove the stopped container to clean up disk space: sudo docker rm test-nginx Step 10: Completely Uninstall Docker When Docker is no longer needed, itβs important to remove it cleanly from your system. Follow these steps to fully uninstall Docker and all related data: Stop and Disable Docker Services sudo systemctl disable --now docker containerd docker.socket Remove Docker Packages and Dependencies sudo apt purge -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin sudo apt autoremove -y --purge Delete Docker Data and Configurations Warning: This will permanently delete all Docker images, containers, volumes, and configurations. Ensure you have backups if needed. sudo rm -rf /var/lib/docker /var/lib/containerd Remove Docker Repository and GPG Key sudo rm -f /etc/apt/sources.list.d/docker.list /etc/apt/keyrings/docker.gpg Delete Docker Group and Configuration Directory sudo groupdel docker sudo rm -rf /etc/docker Conclusion You have successfully installed Docker on Debian 13, tested it with a professional Nginx container, and fully uninstalled Docker when it was no longer required. This tutorial ensures you maintain a clean and efficient container management environment for your Debian systems. Subscribe to Our YouTube for More Download as PDF
















