[root@tom docker-demo]# docker-machine create --driver virtualbox default
Running pre-create checks...
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.21.3.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.
6.0.8r130520". Please upgrade at https://www.virtualbox.org"
docker-machine创建虚拟机时报错,提示运行/sbin/vboxconfig。
运行/sbin/vboxconfig
[root@tom docker-demo]# /sbin/vboxconfig
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 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.21.3.el7.x86_64
This system is currently not set up to build kernel modules.
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.21.3.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.
然后提示安装kernel-devel,输入y 一直等待执行完成
[root@tom docker-demo]# yum install kernel-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
....省略
再次 执行 /sbin/vboxconfig,如下则正常:
[root@tom docker-demo]# /sbin/vboxconfig
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
如果还是提示安装kernel-devel,可能是由于uname -r的内核版本和安装的内核版本不一致导致的,
[root@tom demo04compose]# uname -r
3.10.0-693.21.1.el7.x86_64
[root@tom demo04compose]# ll /usr/src/kernels/
total 4
drwxr-xr-x 22 root root 4096 Jun 21 17:14 3.10.0-957.21.3.el7.x86_64
[root@tom demo04compose]#
此时有两个方法,一个是将内核升级到安装的内核版本,参照: 我是参照。
另一个是找到内核对应版本的kernel-devel安装,卸载原有版本。
只有再次执行/sbin/vboxconfig启动虚拟机