docker官网正确安装-卸载

一、查看系统内核

    uname -r

    3.10.0-229.el7.x86_64

二、Install Docker

  1、Install with yum

    sudo yum update

  2、vi /etc/yum.repos.d/docker.repo

    [dockerrepo]

    name=Docker Repository

    baseurl=https://yum.dockerproject.org/repo/main/centos/7/

    enabled=1

    gpgcheck=1

    gpgkey=https://yum.dockerproject.org/gpg

      vi /etc/yum.repos.d/epel.repo

    [epel]

    name=Extra Packages for Enterprise Linux 6 - $basearch
    #baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
    mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
    failovermethod=priority
    enabled=1
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

    [epel-debuginfo]
    name=Extra Packages for Enterprise Linux 6 - $basearch - Debug
    #baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch/debug
    mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=$basearch
    failovermethod=priority
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
    gpgcheck=1

    [epel-source]
    name=Extra Packages for Enterprise Linux 6 - $basearch - Source
    #baseurl=http://download.fedoraproject.org/pub/epel/6/SRPMS
    mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch=$basearch
    failovermethod=priority
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
    gpgcheck=1

  3、安装docker

    sudo yum install docker-engine

  4、设置开机自启服务

    sudo systemctl enable docker.service

  5、启服务

    sudo systemctl start docker

  6、验证是否正确安装,通过运行一个测试图像在一个容器中。

$ sudo docker run --rm hello-world

 Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c04b14da8d14: Pull complete
Digest: sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9
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:
. The Docker client contacted the Docker daemon.
. The Docker daemon pulled the "hello-world" image from the Docker Hub.
. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
. 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 Hub account:
https://hub.docker.com For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/

三、Uninstall docker

1、查询安装的docker版本

  $ yum list installed | grep docker

  docker-engine.x86_64 1.7.1-0.1.el7@/docker-engine-1.7.1-0.1.el7.x86_64

2、卸载

  $ sudo yum -y remove docker-engine.x86_64

3、删除所有图片、容器和卷,运行以下命令:

  $ rm -rf /var/lib/docker

最新文章

  1. 单据UI界面设计开发
  2. PHP 中的Closure
  3. AndFix热修复 —— 实战与源码解析
  4. CookieStore之Cookie的获取与保存
  5. Java NIO之缓冲区Buffer
  6. 关于C# Math 处理奇进偶不进
  7. 事务的四个特性-ACID
  8. Chapter Schema
  9. Manually connecting to the Oracle Linux Yum Server
  10. redis的主从复制
  11. javascript之ProtoBuf在websocket中的使用
  12. Day-1: Python准备知识
  13. 关于SQL配置管理工具无法打开0x8004100e问题!
  14. django项目微博第三方登录
  15. 把多个js函数绑定到onload时间处理函数上
  16. Asp.Net 拦截请求自定义处理
  17. win32获取浏览器当前Tab的URL
  18. 第三百八十六节,Django+Xadmin打造上线标准的在线教育平台—HTML母版继承
  19. 自动化持续集成Jenkins
  20. hive学习4(hive的脚本执行)

热门文章

  1. java基础之IO流(一)字节流
  2. 设计模式之装饰(Decorator)模式
  3. java 使用POI读取excel数据
  4. Linux中修改docker镜像源及安装docker
  5. [AngularJS Unit tesint] Testing keyboard event
  6. SolidEdge 如何绘制零件图的剖视图
  7. XSS学习分支图
  8. C++写动态站点之HelloWorld!
  9. php中的register_shutdown_function和fastcgi_finish_request
  10. 【前端JS】radio 可单选可点击取消选中