Home >Operation and Maintenance >Docker >How to install docker in apt environment

How to install docker in apt environment

PHPz
PHPzOriginal
2023-04-19 14:12:395996browse

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.

  1. Update apt package list

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
  1. Install necessary software packages

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
  1. Add Docker official GPG key

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 -
  1. Add the Docker official repository

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"
  1. Update apt package list

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
  1. Install Docker

When everything is ready, use the following command to install Docker:

sudo apt-get install docker-ce docker-ce-cli containerd.io
  1. Verify Docker installation

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn