type
status
date
slug
summary
tags
category
icon
password
URL
Docker is a powerful open-source containerization platform that enables efficient application development, deployment, and management. With Docker, you can isolate applications within containers, ensuring consistency across environments and facilitating seamless collaboration.
1. Installing Docker
Docker offers an official installation script to streamline the installation process on Linux systems. Follow the steps below to get Docker running on your machine.
Step 1: Download the Docker Installation Script
To download the Docker installation script, use the
curl
command, saving it as get-docker.sh
:This command fetches the official Docker script that automates the installation process.
Step 2: Run the Installation Script
Now, execute the script to install Docker:
The script automatically identifies the best Docker version for your system and handles downloading and installation. This method is quick and works on most Linux distributions.
2. Verifying Docker Installation
Once Docker is installed, verify it by running:
You should see output similar to this, confirming the Docker version:
Start the Docker Service
On some systems, Docker might not start automatically. To manually start Docker, use:
To set Docker to launch on system boot, run:
3. Allow Non-Root Users to Use Docker
By default, Docker commands require
root
privileges. For security and convenience, add your user to the Docker group to avoid using sudo
each time.- Add your user to the
docker
group:
- Log out and back in, or update your session with:
- Test Docker as a non-root user by running:
If you see "Hello from Docker!", it means Docker is successfully configured for non-root usage.
4. Setting Up Docker in Rootless Mode (Optional)
Rootless mode allows Docker to run with lower privileges, enhancing security by limiting Dockerβs access to the system.
Step 1: Install Rootless Dependencies
To enable rootless mode, start by installing necessary dependencies:
Step 2: Enable Rootless Mode
Run the following setup tool:
After this, configure environment variables as follows:
- Open
.bashrc
and add these lines:
- Apply the changes:
5. Uninstalling Docker (Optional)
If you need to remove Docker from your system, use the following commands:
To delete all associated data files, such as images, containers, and volumes:
This ensures Docker is fully removed from your system.