Ubuntu20.0.0安装docker容器

一、 Docker介绍

  • Docker 是一个开源的应用容器引擎,基于 Go 语言 并遵从 Apache2.0 协议开源。
  • Docker 可以让开发者打包他们的应用以及依赖包到一个轻量级、可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟化。
  • 容器是完全使用沙箱机制,相互之间不会有任何接口(类似 iPhone 的 app),更重要的是容器性能开销极低。
  • Docker 从 17.03 版本之后分为 CE(Community Edition: 社区版) 和 EE(Enterprise Edition: 企业版),我们用社区版就可以了。

二、Ubuntu20.0.0安装Docker

注:root用户下不须要sudo,官方和阿里的源选择其一,建议使用阿里源,速度快。

1.安装前先卸载之前的版本,如果之前有安装

sudo apt-get remove docker docker-engine http://docker.io containerd runc

2.更新ubuntu的apt源索引

sudo apt-get update

3.安装必要的系统工具

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

4.将Docker存储库的GPG密钥添加到系统:(二选一)

1.官方的GPG证书
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

 2.阿里的GPG证书

curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -

5.将Docker存储库添加到APT源: (二选一)

1.官方源

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

2.阿里源

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

 6.安装Docker(社区版)

sudo apt-get install -y docker-ce

 我安装的时候出现了这个错误,后来我关闭了虚拟机,重新启动后恢复正常

E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?

7. 启动Docker

sudo systemctl status docker

猜你喜欢

转载自blog.csdn.net/djklsajdklsajdlk/article/details/125140561