在 CentOS 7.7 上安装 Docker Engine(Install Docker Engine on CentOS 7.7)

安装环境:CentOS Linux release 7.7.1908 (Core)
安装版本:Docker version 19.03.8

部署人员:成长的小猪 Jason Song

目前市面上 Docker 很流行,我们要积极的了解起来哦,首先就是要把它安装起来哦,然后我们一起探索

安装方法

为了简化安装和升级任务,这里我推荐大家使用存储库安装,首次安装Docker Engine之前,需要设置Docker存储库,之后你可以从存储库进行安装和更新Docker。

设置存储库

       1、安装yum-utils软件包(提供yum-config-manager 实用程序)并设置稳定的存储库

root@jasonsoft:~# sudo yum install -y yum-utils

       2、通过以下命令来设置稳定版本的存储库

root@jasonsoft:~# sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

现在我们就开安装 DOCKER 引擎

     1、首先我们来更新apt程序包索引,并安装最新版本的Docker Engine和容器

root@jasonsoft:~# sudo yum install -y docker-ce docker-ce-cli containerd.io

         通过上面的命令安装结束后,我们来确认一下是否已安装成功,通过以下命令确认一下服务是否已启动,看到Active: active (running)状态表示服务已成功启动

[root@jasonsoft ~]# sudo systemctl start docker

[root@jasonsoft ~]# sudo systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: active (running) since Tue 2020-05-12 14:00:44 CST; 3s ago
     Docs: https://docs.docker.com
 Main PID: 1988 (dockerd)
    Tasks: 16
   Memory: 47.1M
   CGroup: /system.slice/docker.service
           └─1988 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

May 12 14:00:44 jasonsoft dockerd[1988]: time="2020-05-12T14:00:44.029450031+08:00" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
May 12 14:00:44 jasonsoft dockerd[1988]: time="2020-05-12T14:00:44.029465388+08:00" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run/cont...module=grpc
May 12 14:00:44 jasonsoft dockerd[1988]: time="2020-05-12T14:00:44.029476117+08:00" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
May 12 14:00:44 jasonsoft dockerd[1988]: time="2020-05-12T14:00:44.078407516+08:00" level=info msg="Loading containers: start."
May 12 14:00:44 jasonsoft dockerd[1988]: time="2020-05-12T14:00:44.309244318+08:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172....IP address"
May 12 14:00:44 jasonsoft dockerd[1988]: time="2020-05-12T14:00:44.363760391+08:00" level=info msg="Loading containers: done."
May 12 14:00:44 jasonsoft dockerd[1988]: time="2020-05-12T14:00:44.392670287+08:00" level=info msg="Docker daemon" commit=afacb8b graphdriver(s)=overlay2 version=19.03.8
May 12 14:00:44 jasonsoft dockerd[1988]: time="2020-05-12T14:00:44.392801249+08:00" level=info msg="Daemon has completed initialization"
May 12 14:00:44 jasonsoft dockerd[1988]: time="2020-05-12T14:00:44.419480872+08:00" level=info msg="API listen on /var/run/docker.sock"
May 12 14:00:44 jasonsoft systemd[1]: Started Docker Application Container Engine.
Hint: Some lines were ellipsized, use -l to show in full.

       能过以下命令查看Docker Engine相关信息

[root@jasonsoft ~]# docker -v
Docker version 19.03.8, build afacb8b

[root@jasonsoft ~]# docker info
Client:
 Debug Mode: false

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 19.03.8
 Storage Driver: overlay2
  Backing Filesystem: <unknown>
  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

  看到上面信息表示安装成功啦,后面我们就可以在Docker Engine上嗨起来了

查看我本人更多原创文章,请点击这里

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章