CentOS7 安装docker

2019-11-18  本文已影响0人  心如苍井_空如水

Docker 要求 CentOS 系统的内核版本高于 3.10
通过 uname -r 命令查看你当前的内核版本

[root@localhost /]# uname -r
3.10.0-957.1.3.el7.x86_64

1.安装一些必要的系统工具

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

2.添加软件源信息

sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

3.更新 yum 缓存

sudo yum makecache fast

4.安装 Docker-ce

sudo yum -y install docker-ce

5.启动 Docker 后台服务

sudo systemctl start docker

配置镜像加速

[root@localhost /]# vi /etc/docker/daemon.json
{ 
 "registry-mirrors": [
        "https://k7da99jp.mirror.aliyuncs.com/",
        "https://dockerhub.azk8s.cn",
        "https://registry.docker-cn.com"
      ]
}

重启docker,并查看docker 信息

#重启docker
[root@localhost /]# systemctl restart docker
#查看docker信息
[root@localhost /]# docker info
Client:
 Debug Mode: false

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 19.03.1
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: systemd
 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: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc version: 425e105d5a03fabd737a126ad93d62a9eeede87f
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 3.10.0-862.el7.x86_64
 Operating System: CentOS Linux 7 (Core)
 OSType: linux
 Architecture: x86_64
 CPUs: 1
 Total Memory: 1.796GiB
 Name: localhost.localdomain
 ID: 6FNH:LEUB:ZXWH:X4G7:IJMH:AIA7:LJIC:CGZC:4XUD:6E6H:WPSF:ZPI2
 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
  #以下为添加的镜像加速器
 Registry Mirrors:
  https://k7da99jp.mirror.aliyuncs.com/
  https://dockerhub.azk8s.cn/
  https://registry.docker-cn.com/
 Live Restore Enabled: false

WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled

停止docker

systemctl stop docker
上一篇下一篇

猜你喜欢

热点阅读