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/
    ```
  • 相关阅读:
    error in ./src/views/demo/ueditor.vue Module build failed: Error: Cannot find module 'node-sass' Require stack:
    Spring Cloud Stream 定时任务消息延迟队列
    项目结构介绍
    Java面试题
    SpringBoot中用SpringSecurity实现用户登录并返回其拥有哪些角色
    MySQL索引优化
    MySQL中的执行计划explain
    SpringBoot之单体应用
    SpringBoot之SSM多模块应用
    Spring-aop面向切面编程笔记
  • 原文地址:https://www.cnblogs.com/mfyang/p/8202540.html
Copyright © 2011-2022 走看看