zoukankan      html  css  js  c++  java
  • Docker Machine

    Docker Machine 是docker三剑客之一,可以快速的创建多台docker虚拟机

    环境:我的环境是windows 10 安装的 VMware  里面安装的Centos7

    一、VirtualBox

    1、epel源、VirtualBox源

    yum -y install epel-release
    cd /etc/yum.repos.d/
    wget https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo

    注:如果你是和我一样安装的mini版本 需要安装wget(-bash: wget: command not found

    yum install -y wget

    2、安装指定版本VirtualBox

    yum search virtualbox
    yum -y install VirtualBox-6.0

    二、安装Docker Machine

    可以到https://github.com/docker/machine/releases看到所有发布版本,我们这里安装Linux版本

    curl -L https://github.com/docker/machine/releases/download/v0.16.2/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine &&
        chmod +x /tmp/docker-machine &&
        sudo cp /tmp/docker-machine /usr/local/bin/docker-machine

    三、使用Docker Machine

    1、创建虚拟机

    docker-machine create --driver virtualbox myBox

    或指定参数(具体参数可以查看 docker-machine --help)

    docker-machine create -d virtualbox  
    --virtualbox-disk-size 30000 
    --virtualbox-cpu-count 2 
    --virtualbox-memory 2048 
    myBox

    或同时创建多个

    for NODE in `seq 1 5`; do docker-machine create --driver virtualbox "node-${NODE}"; done

    2、使用

    查看虚拟机信息

    docker-machine env myBox

    进入虚拟机

    docker-machine ssh myBox

    查看虚拟机列表

    docker-machine ls

    注:如果安装过程顺利,按以上步骤就可以正常使用了,下面我备注一下我安装遇到的问题,如果你也遇到了希望能互相学习

    错误1

    Error with pre-create check: "We support Virtualbox starting with version 5. Your VirtualBox install is "WARNING: The vboxdrv kernel module is not loaded. Either there is no module
    available for the current kernel (3.10.0-957.el7.x86_64) or it failed to
    load. Please recompile the kernel module and install it by
    sudo /sbin/vboxconfig
    You will not be able to start VMs until this problem is fixed.\n6.0.14r133895". Please upgrade at https://www.virtualbox.org"

    解决办法:sudo /sbin/vboxconfig

    错误2

    vboxdrv.sh: Stopping VirtualBox services.
    vboxdrv.sh: Starting VirtualBox services.
    vboxdrv.sh: Building VirtualBox kernel modules.
    This system is currently not set up to build kernel modules.
    Please install the gcc make perl packages from your distribution.
    Please install the Linux kernel "header" files matching the current kernel
    for adding new hardware support to the system.
    The distribution packages containing the headers are probably:
        kernel-devel kernel-devel-3.10.0-957.el7.x86_64
    This system is currently not set up to build kernel modules.
    Please install the gcc make perl packages from your distribution.
    Please install the Linux kernel "header" files matching the current kernel
    for adding new hardware support to the system.
    The distribution packages containing the headers are probably:
        kernel-devel kernel-devel-3.10.0-957.el7.x86_64
    
    There were problems setting up VirtualBox.  To re-start the set-up process, run
      /sbin/vboxconfig
    as root.  If your system is using EFI Secure Boot you may need to sign the
    kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load
    them. Please see your Linux system's documentation for more information.

    解决办法:依次执行以下语句

    1、yum update kernel -y

    2、reboot(重启centos)

    3、yum install kernel-headers kernel-devel gcc make -y

    错误3

    Error with pre-create check: "This computer doesn't have VT-X/AMD-v enabled. Enabling it in the BIOS is mandatory"

    解决办法:我这里是VMware 把这一项勾选上

  • 相关阅读:
    进行C# 编写发送邮箱,报错Error: need EHLO and AUTH first !
    vue使jsZip和FileSaver.js打包下载
    基于js或vue项目实现一次批量文件下载功能
    模块
    now 与 down 中的 ow 发音是否一样?
    __time64_t 解决了 2038 年问题,可是没解决 1969年问题
    MagickSetOption(mw, "jpeg:extent", "...kb"); 这个函数有时结果出乎意料
    解决Idea启动Spring Boot很慢的问题
    CAP原理和BASE思想和ACID模型
    java并发编程之Condition
  • 原文地址:https://www.cnblogs.com/fanxp/p/11802549.html
Copyright © 2011-2022 走看看