zoukankan      html  css  js  c++  java
  • [TimLinux] docker CentOS7安装docker-ce最新版

    1. 环境

    $ lsb_release -a  # 需要安装 redhat-lsb-core 包
    LSB Version: :core-4.1-amd64:core-4.1-noarch
    Distributor ID: CentOS
    Description: CentOS Linux release 7.5.1804 (Core) 
    Release: 7.5.1804
    Codename: Core

    2. 安装docker-ce

    1. 移除旧版本:
    yum remove docker 
                      docker-client 
                      docker-client-latest 
                      docker-common 
                      docker-latest 
                      docker-latest-logrotate 
                      docker-logrotate 
                      docker-selinux 
                      docker-engine-selinux 
                      docker-engine
    
    2. 安装系统工具
    yum install -y yum-utils device-mapper-persistent-data lvm2
    
    3. 添加软件源
    yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    
    4. 更新 yum 缓存
    yum makecache fast
    
    5. 安装docker-ce
    yum -y install docker-ce
    
    6. 启动服务
    systemctl enable docker.service
    systemctl start docker.service
    systemctl status docker.service

    ● docker.service - Docker Application Container Engine
    Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
    Active: active (running) since Tue 2019-02-19 14:32:54 CST; 15min ago
    Docs: https://docs.docker.com
    Main PID: 30656 (dockerd)
    Tasks: 20
    Memory: 58.1M
    CGroup: /system.slice/docker.service
    ├─30656 /usr/bin/dockerd -H fd://
    └─30660 containerd --config /var/run/docker/containerd/containerd.toml --log-level info

    Feb 19 14:32:54 VM_0_7_centos dockerd[30656]: time="2019-02-19T14:32:54.562741035+08:00" level=info msg="Docker daemon" commit=62...18.09.2
    Feb 19 14:32:54 VM_0_7_centos dockerd[30656]: time="2019-02-19T14:32:54.562856673+08:00" level=info msg="Daemon has completed ini...zation"
    Feb 19 14:32:54 VM_0_7_centos dockerd[30656]: time="2019-02-19T14:32:54.600567389+08:00" level=info msg="API listen on /var/run/d...r.sock"
    Feb 19 14:32:54 VM_0_7_centos systemd[1]: Started Docker Application Container Engine.
    Feb 19 14:33:19 VM_0_7_centos dockerd[30656]: time="2019-02-19T14:33:19.281603981+08:00" level=info msg="shim containerd-shim sta...d=30841
    Feb 19 14:33:19 VM_0_7_centos dockerd[30656]: time="2019-02-19T14:33:19.638873050+08:00" level=info msg="shim reaped" id=ebf4c60d...3e8f83a
    Feb 19 14:33:19 VM_0_7_centos dockerd[30656]: time="2019-02-19T14:33:19.648960086+08:00" level=info msg="ignoring event" module=l...Delete"
    Feb 19 14:43:24 VM_0_7_centos dockerd[30656]: time="2019-02-19T14:43:24.662160874+08:00" level=info msg="shim containerd-shim sta...d=31842
    Feb 19 14:43:25 VM_0_7_centos dockerd[30656]: time="2019-02-19T14:43:25.061068379+08:00" level=info msg="shim reaped" id=f70bd83d...edcba6a
    Feb 19 14:43:25 VM_0_7_centos dockerd[30656]: time="2019-02-19T14:43:25.071236528+08:00" level=info msg="ignoring event" module=l...Delete"
    Hint: Some lines were ellipsized, use -l to show in full.

    7. 验证
    docker run hello-world
    
    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.docker.com/
    
    For more examples and ideas, visit:
     https://docs.docker.com/get-started/

    3. 卸载 docker-ce

    yum remove docker-ce
    rm -rf /var/lib/docker

    4. 推荐

    在安装过程中,因为要联网,我的作法是申请了一台免费的腾讯云机器,第一次注册的新用户有15天的免费试用权,希望能够完成多数docker相关任务的研究工作。更多内容请参考:中文文档:https://docs.docker-cn.com/get-started,英文文档:https://docs.docker.com/get-started

  • 相关阅读:
    (转)C++ typename的起源与用法
    EOS智能合约深度解析
    cmake常用变量和命令解析
    (转)Linux下source命令详解
    eosio_install.sh执行过程
    java之collection总结
    Guava之RangeMap
    java file.listFiles()按文件名称、日期、大小排序
    Java下载文件的几种方式
    Java泛型Class<T>、T与Class<?>
  • 原文地址:https://www.cnblogs.com/timlinux/p/10400991.html
Copyright © 2011-2022 走看看