In the vast ocean of software development, containerization technology is like a reliable ship, helping developers sail smoothly in the surging waves of system differences and compatibility issues. Among the numerous containerized tools, Docker stands out for its reliability and ease of use and becomes a beacon for guiding the way. Docker can package the software and everything it needs to run (code, runtime environment, system tools, system libraries, etc.) into a complete system file to ensure that the software can maintain a consistent running state in any environment. This article will guide you to install Docker on Linux system and start your containerization journey.
Before system requirements set sail, make sure your Linux system is ready to take advantage of Docker.
Updating the system package to sail using outdated maps is undoubtedly disastrous. Similarly, updating the system's package database before installing Docker ensures a smoother installation process.
sudo apt-get update
It is always wise to choose a calm water navigation. Installing Docker from an official repository is exactly the case.
Setting up Docker repository 1. Update the apt package index :
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
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
Install Docker Engine 1. Update the apt package index again (if not executed yet):
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
Verify installation 1. Run the Docker hello-world image :
sudo docker run hello-world
docker --version
For developers who are time-intensive or prefer a simpler approach, Docker provides a convenient installation script.
curl -fsSL https://get.docker.com | sh
After installing Docker, understanding some basic commands will help you get started.
sudo systemctl start docker sudo systemctl stop docker sudo systemctl restart docker
docker run [IMAGE]
docker pull [IMAGE]
You have successfully installed Docker on your Linux system and have taken the first step toward the containerized world. After mastering the basic commands, the powerful features of Docker will be waiting for you to explore. The official Docker documentation is an excellent guide to gain insight into advanced configuration and optimization. I wish you all the best on your voyage at Docker!
The above is the detailed content of Simplifying Docker Installation on Linux. For more information, please follow other related articles on the PHP Chinese website!