Docker学习之CentOS8安装Docker

该博客主要介绍在CentOS系统安装Docker的步骤。首先要检查前提条件,包括内核版本是否高于3.8、Device Mapper情况,若无则需安装并加载内核模块;接着进行Docker安装,设置阿里源、安装依赖、添加yum仓库、安装docker - ce,最后启动并设置开机自启,查看运行状态。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

检查前提条件

检查内核版本是否高于3.8

uname -a

检查Device Mapper

ls -l /sys/class/misc/device-mapper

或者

grep device-mapper /proc/devices

若无,请安装

yum install -y device-mapper

安装完成后,加载dm_mod内核模块

modprobe dm_mod

 

安装Docker

设置阿里源

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo

安装依赖

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

添加docker-ce的yum仓库

yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum makecache

安装docker-ce

yum install docker-ce

启动并设置开机自启动

systemctl start docker
systemctl enable --now docker

查看Docker运行状态

docker info

显示如下打印

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 19.03.13
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 8fba4e9a7d01810a393d5d25a3621dc101981175
 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.18.0-193.14.2.el8_2.x86_64
 Operating System: CentOS Linux 8 (Core)
 OSType: linux
 Architecture: x86_64
 CPUs: 1
 Total Memory: 791.5MiB
 Name: localhost.localdomain
 ID: YXYV:NBGI:LTFS:X3F7:Y7MN:OSHA:APHW:GA3Q:DOEB:7BCZ:FWDK:UON2
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值