Centos 7 安装Docker-ce记录

本文介绍如何在CentOS 7上通过RPM方式安装Docker,并验证安装是否成功。此外还提供了卸载Docker的步骤。

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

  以前尝试过在centos 6上安装Docker , 需要升级内核,支持aufs,比较麻烦;在使用过程中出现过Docker挂掉的情况,官方建议在64 位 centos 7 上运行,本文将安装步骤记录下来,以便查看:

  官方提供了三种安装方式:

  1、从 Docker Repositories 安装

  2、RPM安装(方便,便捷)

  3、脚本安装。

  一、本文使用RPM的方式安装:

  1> 下载  rpm 包 ,地址:https://download.docker.com/linux/centos/7/x86_64/stable/Packages/ 

  2> 安装  yum install /path/to/package.rpm    注: /path/to/package.rpm 是rpm包下载后的路径及包名

    或:以docker-ce-17.06.2.ce-1.el7.centos.x86_64.rpm 为例 , 可以使用:

      yum install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-17.06.2.ce-1.el7.centos.x86_64.rpm

  3> 启动 Docker  systemctl start docker

  4> 检验 Docker 是否安装成功  docker run hello-world, 出现如下界面,表示Docker安装成功!

[root@localhost src]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b04784fba78d: Pull complete 
Digest: sha256:f3b3b28a45160805bb16542c9531888519430e9e6d6ffc09d72261b0d26ff74f
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.
 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://cloud.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/engine/userguide/

  二、卸载 Docker 的步骤:
  1、卸载 docker 相关的包  yum remove docker-ce

  2、删除 docker 相关文件  rm -rf /var/lib/docker

转载于:https://www.cnblogs.com/logo-fox/p/7404146.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值