Linux安装Docker
2022/3/4 7:17:36
本文主要是介绍Linux安装Docker,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
Linux安装Docker
- 内核版本需要3.10以上
- 查看内核版本命令 uname -r
1、更新yum源
[root@localhost ~]# yum -y update
2、安装依赖包
[root@localhost ~]# yum -y install yum-utils device-mapper-persistent-data lvm2
3、设置docker的yum源
[root@localhost ~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo # 官方 [root@localhost ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo # 阿里云
4、安装Docker
[root@localhost ~]# yum -y install docker-ce docker-ce-cli containerd.io
5、Docker服务启动、重启、停止及状态查看
[root@localhost ~]# systemctl start docker # 启动 [root@localhost ~]# systemctl restart docker # 重启 [root@localhost ~]# systemctl status docker # 状态 [root@localhost ~]# systemctl stop docker # 停止 [root@localhost ~]# systemctl enable docker # 设置开机自启
6、验证
[root@localhost ~]# docker version
7、Docker加速器
-
使用加速器可以提升获取Docker官方镜像的速度
-
登录阿里云获取加速地址 https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors
-
Linux中配置加速地址
[root@localhost ~]# vim /etc/docker/daemon.json [root@localhost ~]# systemctl daemon-reload # 重启daemon [root@localhost ~]# systemctl restart docker # 重启docker
{ "registry-mirrors": ["https://o7h0exrr.mirror.aliyuncs.com"] }
8、其他
[root@localhost ~]# docker --help # 查看帮助文档 [root@localhost ~]# docker info # 查看概要信息 [root@localhost ~]# docker images # 查看本地镜像
这篇关于Linux安装Docker的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-03-28duckdns docker
- 2024-03-21docker add host
- 2024-03-14denied: requested access to the resource is denied docker push
- 2024-03-07docker graylog
- 2024-03-05Docker容器实战(00)-基础命令大全
- 2024-03-01dockerd-entrypoint.sh
- 2024-02-23linux mint install docker
- 2024-01-18angular docker
- 2024-01-10优雅而强力地卸载docker-desktop
- 2024-01-09完蛋,我被挖矿木马包围了|使用 TLS 连接 Docker