程序员潇然 发表于 2022-10-9 11:27:46

docker linux环境下的安装步骤过程

安装docker
Linux 内核:官方建议 3.10 以上

### 1.查看当前的内核版本

!(data/attachment/forum/202210/09/112033bgz2d3aydgt2bvc4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

### 2.检查是否安装过

`yum remove dockerdocker-common docker-selinux docker-engine`
检查确认是否有残留的包(之前安装过的包)

!(data/attachment/forum/202210/09/112055nozd7ib7qiyoit67.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

### 详细步骤

1.安装需要的软件包, yum-util 提供yum-config-manager功能,另两个是devicemapper驱动依赖

`yum install -y yum-utils device-mapper-persistent-data lvm2`

!(data/attachment/forum/202210/09/112240nwewfrrnmyparnfp.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

2.设置 yum 源

设置一个yum源,下面两个都可用,中央仓库国外,通常较慢,可以使用阿里的
`yum-config-manager --add-repo http://download.docker.com/linux/centos/docker-ce.repo`                   (中央仓库)

`yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo`                   ( 阿里仓库)

!(data/attachment/forum/202210/09/112313p1pevvbxjv1bvrhh.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

3.选择docker版本并安装
(1)查看可用版本有哪些

`yum list docker-ce --showduplicates | sort -r`

!(data/attachment/forum/202210/09/112340xsqhs1kv2sbq02sl.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

可以指定版本安装

版本号中可以忽略 : 前面的和 .el7,如 docker-ce-18.09.1   也就是   yum install docker-ce-版本号

!(data/attachment/forum/202210/09/112546tnabxqeuv7n97axr.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

!(data/attachment/forum/202210/09/112608mmdjt0kc9txtr4c4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

如果想添加到开机启动
`systemctl enable docker`

启动 docker 服务
`systemctl start docker`

!(data/attachment/forum/202210/09/112648shozgx56cy2ayos2.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

查看版本

!(data/attachment/forum/202210/09/112704a1k8e5yz7m888ioz.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

基本检查

!(data/attachment/forum/202210/09/112740gm227m26kemc66dq.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

!(data/attachment/forum/202206/16/141330jha7st9soow8772i.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "common_log.png")
`转载务必注明出处:程序员潇然,疯狂的字节X,https://crazybytex.com/thread-195-1-1.html `
页: [1]
查看完整版本: docker linux环境下的安装步骤过程