Let me walk you through the steps to install docker on Ubuntu today. Since I was installing it on my system, I decided to write a tutorial to visually guide you through it so you can ensure you have docker up and running by the end of this guide.

现在让我引导您完成在Ubuntu上安装docker的步骤。 自从将其安装在系统上以来,我决定编写一个教程以直观地指导您完成安装过程,以便在本指南结束时确保已启动并运行docker。

Before we begin to install docker on our Ubuntu system, let met get you familiarized with what docker is. If you want to skip to the installation steps, click here.

在我们开始在我们的Ubuntu系统上安装docker之前,先让met熟悉一下docker是什么。 如果要跳至安装步骤, 请单击此处 。

什么是Docker? (What is Docker?)

The Docker engine is open-source software designed to build and run applications in isolated environments known as containers.

Docker引擎是开源软件,旨在在称为容器的隔离环境中构建和运行应用程序。

It uses OS-level virtualization to run the applications. This is similar to virtual machines but the Docker engine offers a more resource-friendly and portable environment to our processes.

它使用操作系统级别的虚拟化来运行应用程序。 这类似于虚拟机,但Docker引擎为我们的流程提供了更资源友好和可移植的环境。

Developed by Docker.Inc under the Apache License, the Docker engine hosts images, networks, and containers through a server-side daemon process. Since its initial release in 2013, Docker has grown massively in demand and reputation.

Docker引擎是由Docker.Inc在Apache许可下开发的,它通过服务器端守护进程来托管映像,网络和容器。 自2013年首次发布以来,Docker的需求和声誉已大大提高。

在Ubuntu上安装Docker的步骤 (Steps to Install Docker on Ubuntu)

To install the Docker engine on your Ubuntu system, you need to have a 64-bit version of Ubuntu. The Docker Engine is supported only on the systems with the following architectures.

要在Ubuntu系统上安装Docker引擎,您需要具有64位版本的Ubuntu。 Docker引擎仅在具有以下架构的系统上受支持。

  • x86_64/amd64x86_64 / amd64
  • armhf臂架
  • arm64臂64
  • s390x (IBM Z)s390x(IBM Z)
  • ppc64le (IBM Power) ppc64le(IBM Power)

1.清理以前的Docker安装的系统 (1. Clean your system of previous docker installs)

Before we install the Docker engine on our system, we need to remove any previous installations of docker. To do so, enter the following command in your terminal.

在我们的系统上安装Docker引擎之前,我们需要删除所有以前安装的Docker。 为此,请在终端中输入以下命令。


sudo apt --purge remove docker docker-engine docker.io containerd runc

This will remove any previous installations of docker on your system if present. It is okay if the command says that none of these packages were installed.

如果存在,这将删除系统上以前安装的任何docker。 如果命令说这些软件包都没有安装,那就可以了。

In case you ever had an older installation of Docker on your system, the contents of /var/lib/docker/ have been retained. This includes any images, networks, or containers.

如果您在系统上安装了较旧的Docker,则/ var / lib / docker /的内容将保留。 这包括任何图像,网络或容器。

If you also wish to delete all the settings from your previous installs, you can delete them using the below command.

如果还希望删除以前安装的所有设置,则可以使用以下命令将其删除。


sudo rm -rf /var/lib/docker

This will delete the Docker library on your system with all the files it contains. Now we are ready to set up the installation of the Docker engine on our machine.

这将删除系统上包含所有文件的Docker库。 现在我们准备在我们的机器上安装Docker引擎。

2.在您的Ubuntu计算机上设置Docker存储库 (2. Setting up the Docker Repository on your Ubuntu machine)

Let’s move on to installing the Docker engine on your system.

让我们继续在系统上安装Docker引擎。

There are three methods to install the Docker engine on Ubuntu:

有三种方法可以在Ubuntu上安装Docker引擎:

  • Using the Docker repository (recommended)使用Docker存储库(推荐)
  • Manually installing the Docker package手动安装Docker软件包
  • Using the automated convenience scripts.使用自动便利脚本。

In this tutorial, we will use the recommended method of installation using the Docker repository. To do so, we need to first update the apt repository. This can be done using this command.

在本教程中,我们将使用推荐的使用Docker存储库的安装方法。 为此,我们需要先更新apt仓库 。 可以使用此命令来完成。


sudo apt update

Next, we will install the necessary packages to allow the apt command to use a repository over the HTTPS protocol. These commands will install all the required packages for the task.

接下来,我们将安装必要的软件包,以允许apt命令通过HTTPS协议使用存储库。 这些命令将安装任务所需的所有软件包。


sudo apt install apt-transport-https ca-certificates curl software-properties-common

Now, we will add the official GPG key by Docker to our repository using the following command.

现在,我们将使用以下命令将Docker的官方GPG密钥添加到我们的存储库中。


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

Next, we will verify if we have the correct key having the fingerprint:

接下来,我们将验证我们是否具有带有指纹的正确密钥:


9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88

We will do so by searching for the last 8 digits of the fingerprint in our repository with this command.

为此,我们将使用此命令在存储库中搜索指纹的后8位。


sudo apt-key fingerprint 0EBFCD88
Apt Key
快捷键

If all steps were followed correctly, you should see the above output confirming the key. Now we will set up the stable repository for our Docker engine.

如果正确执行了所有步骤,则应该看到上述输出确认密钥。 现在,我们将为Docker引擎建立稳定的存储库。

Note that you can set up a nightly or test repository by adding the word ‘nightly’ or ‘test’ after ‘stable’ in the command given below.

请注意 ,您可以通过在下面给出的命令中的“ stable”之后添加“ nightly”或“ test”一词来设置每晚测试存储库。


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

Notice that the command says [arch=amd64]. This is the repository for the x86_64 / amd64 architecture systems. If your system has a different architecture, make sure to replace the architecture name accordingly. Once we add the repository, we can now proceed to install the Docker engine on our system.

请注意,该命令显示[ arch = amd64]。 这是x86_64 / amd64体系结构系统的存储库。 如果您的系统具有不同的体系结构,请确保相应地替换体系结构名称。 添加存储库后,我们现在可以继续在系统上安装Docker引擎。

3.安装Docker引擎 (3. Installing the Docker engine)

To install the latest version of the Docker engine on our machine, we first update our repositories again as we did earlier. Next, we use the apt command to install the Docker engine on our system as follows.

要在我们的计算机上安装最新版本的Docker引擎,我们首先像之前一样再次更新存储库。 接下来,我们使用apt命令如下所述在我们的系统上安装Docker引擎。


sudo apt install docker-ce docker-ce-cli containerd.io
Apt Install Docker Engine
Apt安装Docker Engine

You should see the above output which confirms the installation of the Docker engine on your system. Note that if you have multiple repositories set up and you use the apt command without specifying, the command will install the highest available version of the program on your machine. This can cause issues related to the program’s stability.

您应该看到上面的输出,该输出确认您的系统上已安装Docker引擎。 请注意,如果您设置了多个存储库,而未指定使用apt命令,则该命令将在计算机上安装程序的最高可用版本。 这可能会导致与程序稳定性有关的问题。

This can be managed by specifying the version of the program which you wish to install on your system. To install a specific version of the Docker engine, you need to first list the available versions of the program in your repository as follows.

这可以通过指定要在系统上安装的程序的版本来管理。 要安装特定版本的Docker引擎,您需要首先在存储库中列出程序的可用版本,如下所示。

Apt Cache Madison Docker
Apt缓存Madison Docker

Now, we install the desired version of the program by replacing <VERSION_STRING> in the following command by the version name, for example 5:19.03.9~3-0~ubuntu-bionic.

现在,通过将以下命令中的<VERSION_STRING> 替换为版本名称,例如5:19.03.9〜3-0〜ubuntu-bionic ,来安装所需的程序版本。


sudo apt install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io

This will install your desired version of the Docker engine on your system.

这将在系统上安装所需版本的Docker引擎。

4.在Ubuntu机器上测试Docker安装 (4. Testing your Docker install on your Ubuntu machine)

We will verify the installation by running the hello-world image in the Docker engine. To do so, we use this command in our terminal

我们将通过在Docker引擎中运行hello-world映像来验证安装。 为此,我们在终端中使用此命令

This will download the hello-world test image and run it in a container before exiting. Once the verification is done, your Docker engine installation is complete. Now you can add users and start working with the program.

这将下载hello-world测试映像并在退出前在容器中运行。 验证完成后,您的Docker引擎安装完成。 现在,您可以添加用户并开始使用该程序。

Docker Hello World
Docker Hello World

When you need to update your installation of the Docker engine, just run the apt update command. Then you need to follow the installation process again, choosing the newer version which you just downloaded.

当您需要更新Docker引擎的安装时,只需运行apt update命令。 然后,您需要再次遵循安装过程,选择刚下载的较新版本。

结论 (Conclusion)

The Docker engine is a powerful tool for building and testing applications in isolated environments. With the high-performance docker daemon managing the containers, images and networks, the Docker engine is widely preferred by developers across the world.

Docker引擎是用于在隔离环境中构建和测试应用程序的强大工具。 借助高性能的docker守护程序管理容器,图像和网络,Docker引擎被全世界的开发人员广泛青睐。

We hope that this tutorial was able to help you install the Docker engine on your Ubuntu system. If you have any comments, queries or suggestions, feel free to reach us in the comments below.

我们希望本教程能够帮助您在Ubuntu系统上安装Docker引擎。 如果您有任何意见,疑问或建议,请随时通过以下评论与我们联系。

翻译自: https://www.journaldev.com/42048/install-docker-on-ubuntu

在Ubuntu上安装Docker –分步指南相关推荐

  1. couchdb 安装_如何在Ubuntu上安装CouchDB –分步指南

    couchdb 安装 In this tutorial, we'll go over how to install CouchDB on Ubuntu. CouchDB is a NoSQL data ...

  2. centos和ubuntu上安装Docker

    前言 简单来说Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的Linux机器上,也可以实现虚拟化,容器是完全使用沙箱机制,相互之间 ...

  3. ubuntu上安装docker

    在Ubuntu16.04上安装Docker Docker是一个开源的容器引擎,它有助于更快地交付产品. Docker可将应用程序和基础设施层隔离,并且将基础设施当作程序一样进行管理. 使用Docker ...

  4. 如何在 Ubuntu 上安装 Docker Desktop ?

    通常都是在命令行上运行和管理 Docker 容器映像,往往会让 Docker 的初学者望而生畏,这时 Docker Desktop 就有用武之地了. Docker Desktop 由 Docker 开 ...

  5. 在Ubuntu上安装Docker Engine

    前提条件 操作系统要求 要安装Docker Engine,您需要以下Ubuntu版本之一的64位版本: Ubuntu Eoan 19.10 Ubuntu Bionic 18.04(LTS) Ubunt ...

  6. 在Ubuntu上安装docker

    在安装docker之前要提前检查自己的环境 前提条件 Ubuntu 版本要求 Docker 只能安装在 64 位系统上,而且 Linux 内核版本至少是 3.10 及以上. 开始安装: [xinsz@ ...

  7. ubuntu上安装Docker教程

    更新源 sudo apt-get update 使用apt安装: sudo apt-get install \ apt-transport-https \ ca-certificates \curl ...

  8. docker学习(一)ubuntu上安装docker

    准备 你需要64位的ubuntu操作系统 Cosmic 18.10.Bionic 18.04 (LTS).Xenial 16.04 (LTS)其中之一. docker支持的架构为:x86_64 (or ...

  9. Armbian (jammy) 上安装 Docker

    一.Armbian 的软件源配置 Ubuntu 的软件源配置文件是 /etc/apt/sources.list. # 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释 de ...

最新文章

  1. 易点租加速电脑租赁市场布局
  2. 突然吐字不清_突然口齿不清是什么病
  3. 这些 IDEA 的优化设置赶紧安排起来,效率提升不是一点点!
  4. Git连载(9)使用Eclipse作为Git客户端
  5. FedML联邦机器学习框架正式开源,助力算法开发和性能比较
  6. c语言中转义字符是由什么和什么构成,c语言中什么是转义字符
  7. 《概率论与数理统计习题全解指南》中的“计算机得”
  8. 华为鸿蒙系统技术细节盘点
  9. opencv之namedWindow,imshow出现两个窗口
  10. 入门实践,Python数据分析
  11. Java程序员的日常
  12. hdu 4288 Coder (成都赛区 线段树)
  13. leetcode 46 Permutations ----- java
  14. 当python撞上echarts时 add各个图形参数
  15. 二端口输入阻抗和输出阻抗
  16. 【原创分享·支付宝支付】HBuilder打包APP调用支付宝客户端支付
  17. G6-Editor 编辑器入门使用教程
  18. ati自定义分辨率_真三7:猛将传自定义分辨率图文教程
  19. 2018年11月TIOBE编程语言排行榜,Java稳居第一
  20. 美国东北大学计算机科学,美国东北大学计算机专业排名

热门文章

  1. 傅里叶变换的终极解释下
  2. [转载] boost python numpy_boost.python 与 boost.numpy安装的一些注意事项
  3. [转载] Python基础:用Python统计列表中每个单词出现的次数(split 的使用,for双重循环)
  4. ubuntu环境下,ubuntu16.04装机到nvdia显卡驱动安装、cuda8安装、cudnn安装
  5. 软件工程课程设计团队项目总结与项目报告
  6. RabbitMQ消息队列入门篇(环境配置+Java实例+基础概念)
  7. SpringData环境搭建代码编写
  8. python画决策树
  9. scrum 11.27
  10. XAMPP中启动tomcat报错的解决方法