Docker is an open source containerization platform that allows developers to create, deploy and run applications more easily. Before using Docker, you need to install Docker on the server. This article will introduce how to install Docker in apt environment.
Before installing Docker, you need to update the apt package list to ensure that the installed software is the latest version. Enter the following command in the terminal:
sudo apt-get update
Docker requires some necessary software packages to install and run properly. Enter the following command in the terminal to install these packages:
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
To ensure security when downloading software from Docker official repository, Docker official GPG key needs to be added. Enter the following command in the terminal to add the key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Now you need to add the Docker official repository to the apt source to be able to access it from the Download the Docker software package from the warehouse. Enter the following command in the terminal:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
After adding the Docker official warehouse, you need to update the apt package list again. Enter the following command in the terminal:
sudo apt-get update
When everything is ready, use the following command to install Docker:
sudo apt-get install docker-ce docker-ce-cli containerd.io
After the installation is complete, use the following command to verify whether Docker is installed successfully:
sudo docker run hello-world
If Docker is installed successfully, the following information will be output:
Hello from Docker! This message shows that your installation appears to be working correctly. ...
At this point, you have successfully installed Docker in the apt environment. Now you can use Docker to deploy your application.
The above is the detailed content of How to install docker in apt environment. For more information, please follow other related articles on the PHP Chinese website!