玖叶教程网

前端编程开发入门

Ubuntu linux系统安装docker(ubuntu20 安装docker)

Linux学习笔记总结(一百零一)-Ubuntu linux系统安装docker

Docker是一个开源的应用容器引擎。容器完全使用沙箱机制,相互之间不会有任何的接口。虽然现在也可以安装到windows机器上,但是主要是应用在linux系统上,生产环境中也建议安装在linux系统上。接下来我们就在Ubuntu上安装docker:

1、Ubuntu liux系统版本

Ubuntu linux版本查看:

root@jx001:~# lsb_release -a

No LSB modules are available.

Distributor ID: Ubuntu

Description: Ubuntu 20.04.1 LTS

Release: 20.04

Codename: focal

如果安装了docker的旧版本,请把旧版本的docker容器卸载了。

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

2、更新apt包索引

sudo apt-get update

3、确保apt能使用https方式并且CA证书已安装

sudo apt-get install \

apt-transport-https \

ca-certificates \

curl \

gnupg \

lsb-release

4、添加Docker官方的gpg密钥

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

5、设置稳定存储库

echo \

"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \

$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/nul

6、更新apt包索引

sudo apt-get update

7、安装docker容器及相关程序

sudo apt-get install docker-ce docker-ce-cli containerd.io

8、启动docker

systemctl start docker

9、查看安装好的客户端和服务器版本,以及网卡信息

10、设置开机自启动

systemctl enable docker

11、配置镜像加速器

sudo vi /etc/docker/daemon.json

{

"registry-mirrors": ["https://0jpa4err.mirror.aliyuncs.com"]

}

sudo systemctl daemon-reload

sudo systemctl restart docker

发表评论:

控制面板
您好,欢迎到访网站!
  查看权限
网站分类
最新留言