Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to install Docker in Ubuntu operating system

Shulou Source: shulou.com Published: 2022-06-01 13:13:33 09月20日 Update

This article focuses on "how to install Docker in the Ubuntu operating system", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to install Docker in the Ubuntu operating system.

Docker is an open source application container engine that allows developers to package their applications and dependency packages into a portable container, publish them to any popular Linux machine, and virtualize them. Containers are fully sandboxed and will not have any interface with each other.

In today's article, let's install Docker on Ubuntu.

1. Since the docker version in the apt official library in Ubuntu may be relatively low, uninstall the old version (if any) first using the following command line

Sudo apt-get remove docker docker-engine docker-ce docker.io

two。 Update the apt package index:

Sudo apt-get update

3. Execute the following command line to enable apt to use the repository through the HTTPS protocol:

Sudo apt-get install-y apt-transport-https ca-certificates curl software-properties-common

4. Add the official GPG key provided by Docker:

Curl-fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add-

What is a GPG key? You can get the answer from teacher Ruan Yifeng's blog: introduction to GPG:

In 1991, programmer Phil Zimmermann developed the encryption software PGP to avoid government surveillance. This software is very easy to use, quickly spread, and has become a necessary tool for many programmers. However, it is commercial software and cannot be used freely. So the Free Software Foundation decided to develop a replacement for PGP, which is called GnuPG. This is the origin of GPG.

The above text comes from teacher Ruan Yifeng's blog link: http://www.ruanyifeng.com/blog/2013/07/gpg.html

5. Set up the stable repository:

Sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release-cs) stable"

Finally, update the apt package index again:

6. Install the latest version of docker-ce:

Sudo apt-get install-y docker-ce

After the installation, you can see that the Docker service has been started from / lib/systemd/system/docker.service, and the dockerd process id is 4921:

Command line ps-aux to view the process path with id 4921: / usr/bin/dockerd-H fd://

Use the command sudo docker version to view the version in which docker is installed:

Using the command sudo docker run hello-world, you can observe that the container for this test is downloaded remotely: Pulling from library/hello-world:

Then you see the printed message: Hello from Docker! Indicates that Docker is installed successfully.

At this point, I believe you have a deeper understanding of "how to install Docker in the Ubuntu operating system". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Commands containers versions software operating systems systems Ryan processes development freedom content blogs official keys programs programmers indexes teachers facets Yifeng Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Microsoft Shulou Tech Info Docker Shulou Information