zoukankan      html  css  js  c++  java
  • docker安装

    docker yum源配置

    1. 安装依赖软件包 yum-utils,device-mapper-persistent-data 和 lvm2

      yum-utils:用于提供 yum-config-manager命令行工具

      device-mapper-persistent-data 和 lvm2:用于devicemap存储驱动

      yum install -y yum-utils device-mapper-persistent-data lvm2
      
    2. 添加docker-ce.repo

      yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
      
    3. 可选配置 启用或禁用docker软件包的edge和test分支,主要提供新特性的测试版

      启用:

      yum-config-manager --enable docker-ce-edge
      yum-config-manager --enable docker-ce-test
      

    禁用:

    shell yum-config-manager --disable docker-ce-edge yum-config-manager --disable docker-ce-test

    安装docker

    1. 检索yum源
      [root@master yum.repos.d]# yum list docker-ce  
      Loaded plugins: fastestmirror, langpacks  
      docker-ce-stable  | 2.9 kB  00:00:00   
      docker-ce-stable/x86_64/primary_db|  11 kB  00:00:01   
      Loading mirror speeds from cached hostfile
       * base: mirrors.aliyun.com  
       * epel: mirrors.aliyun.com  
       * extras: mirrors.aliyun.com  
       * updates: mirrors.aliyun.com  
      Available Packages  
      docker-ce.x86_64 17.12.0.ce-1.el7.centos docker-ce-stable
      

    这里已经能从yum源里检索到了docker-ce的软件包了,接下安装就行。
    2. 安装docker

    shell yum install docker-ce-17.12.0.ce-1.el7.centos yum install docker-ce-selinux
    3. 启动docker

    shell [root@master yum.repos.d]# systemctl start docker [root@master yum.repos.d]# 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 Thu 2018-01-04 16:59:21 CST; 6s ago Docs: https://docs.docker.com Main PID: 126183 (dockerd) Memory: 30.0M CGroup: /system.slice/docker.service ├─126183 /usr/bin/dockerd └─126190 docker-containerd --config /var/run/docker/containerd/cont... Jan 04 16:59:21 master dockerd[126183]: time="2018-01-04T16:59:21+08:00" lev...rd Jan 04 16:59:21 master dockerd[126183]: time="2018-01-04T16:59:21.304543557+...s" Jan 04 16:59:21 master dockerd[126183]: time="2018-01-04T16:59:21.305864672+...." Jan 04 16:59:21 master dockerd[126183]: time="2018-01-04T16:59:21.431345841+...s" Jan 04 16:59:21 master dockerd[126183]: time="2018-01-04T16:59:21.484089063+...." Jan 04 16:59:21 master dockerd[126183]: time="2018-01-04T16:59:21.490360169+...x" Jan 04 16:59:21 master dockerd[126183]: time="2018-01-04T16:59:21.500279497+...ce Jan 04 16:59:21 master dockerd[126183]: time="2018-01-04T16:59:21.500509381+...n" Jan 04 16:59:21 master dockerd[126183]: time="2018-01-04T16:59:21.507349994+...k" Jan 04 16:59:21 master systemd[1]: Started Docker Application Container Engine. Hint: Some lines were ellipsized, use -l to show in full.
    4. 测试docker是否可以正常运行

    ```shell
    [root@master yum.repos.d]# docker run hello-world
    Unable to find image 'hello-world:latest' locally
    latest: Pulling from library/hello-world
    ca4f61b1923c: Pull complete
    Digest: sha256:445b2fe9afea8b4aa0b2f27fe49dd6ad130dfe7a8fd0832be5de99625dad47cd
    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.
    (amd64)
    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 ID:
     https://cloud.docker.com/
    
    For more examples and ideas, visit:
     https://docs.docker.com/engine/userguide/
    ```
  • 相关阅读:
    Tomcat安装(安装版)
    Selenium自动化测试(一)之环境搭建
    Windows快速启动应用高效搜索文件工具-Listary
    Python3之jsonpath使用和json转换
    Python3操作SQLite数据库
    初识面向对象
    忘记虚拟机中Linux的登录密码解决办法
    win10自带虚拟机的使用(Hyper-v)
    nigx下配置tp5.1路由
    PHP无限极菜单
  • 原文地址:https://www.cnblogs.com/mfyang/p/8202540.html
Copyright © 2011-2022 走看看