日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

記錄下在CentOS7中安裝Docker CE

 冒險的K 2021-09-08

記錄下在CentOS7中安裝Docker CE

1. 卸載系統(tǒng)中可能存在的老版本

  •   在CentOS中,老版本Docker的軟件包名是docker或docker-engine,而Docker CE的軟件包名稱是docker-ce。因此,若已安裝過老版本的Docker,需使用如下命令卸載

    • //復(fù)制如下代碼,在Linux上直接執(zhí)行

      sudo yum remove docker \
      docker-common \
      docker-selinux \
      docker-engine

  • 需要注意的是,執(zhí)行該命令只會卸載Docker本身,不會刪除Docker存儲的文件,例如鏡像、容器、卷以及網(wǎng)絡(luò)文件等。這些文件保存在/var/lib/docker目錄中,需要手動刪除。

2. 開始安裝docker CE

  • 復(fù)制執(zhí)行以下命令,安裝Docker所需的包。其中:

    • yum-utils: 提供yum-conf ig-manager的工具;

    • device-mapper-persistent-data及l(fā)vm2: 是devicemapper存儲驅(qū)動所需的包.

    • sudo yum install -y yum-utils device-mapper-persistent-data lvm2
  • 復(fù)制執(zhí)行如下命令,安裝stable倉庫。必須安裝stable倉庫,即使你想安裝edge或test倉庫中的Docker構(gòu)建版本。

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

  • [可選]執(zhí)行如下命令,啟用edge及test倉庫。edge/test倉庫中其實也包含在了docker.repo文件中,但默認(rèn)是禁用的,可使用以下命令啟用

    • sudo yum-config-manager --enable docker-ce-edge  #啟動edge倉庫, 如果想要禁用將enable改為disable即可
      sudo yum-config-manager --enable docker-ce-test #啟動test倉庫
  • 復(fù)制執(zhí)行以下命令,更新yum的包索引

    • sudo yum makecache fast
  • 復(fù)制執(zhí)行如下命令即可安裝最新版本的Docker CE

    • sudo yum install docker-ce
  • 啟動docker

    • sudo systemctl start docker
  • 驗證安裝是否正確

    • Unable to find image 'hello-world:latest' locally
      latest: Pulling from library/hello-world
      b8dfde127a29: Pull complete 
      Digest: sha256:7d91b69e04a9029b99f3585aaaccae2baa80bcf318f4a5d2165a9898cd2dc0a1
      Status: Downloaded newer image for hello-world:latest
      
      Hello from Docker!This message shows that your installation appears to be working correctly.
      
      To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
          (amd64) 3. The Docker daemon created a new container from that image which runs the
          executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it
          to your terminal.
      
      To try something more ambitious, you can run an Ubuntu container with:
       $ docker run -it ubuntu bash
      
      Share images, automate workflows, and more with a free Docker ID:
       https://hub./For more examples and ideas, visit:
       https://docs./get-started/
    • sudo docker run hello-world
    • 返回結(jié)果如下

  • 卸載:

    • sudo yum remove docker-ce #卸載docker-ce
      sudo rm -rf /var/lib/docker #強(qiáng)制刪除docker相關(guān)文件

使用腳本來安裝Dockers

  •   依次執(zhí)行如下命令:

    • curl -fsSL get. -o get-docker.sh
    •  sudo sh get-docker.sh
    • www.awaedu.com

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多