我正在尝试在容器中使用docker-machine和virtualbox。
主持人: Ubuntu 16.04
我安装在主机
sudo apt-get install linux-headers-generic virtualbox-dkms
Dockerfile定义
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y \
ca-certificates \
curl \
software-properties-common \
--no-install-recommends \
build-essential && \
curl -sSL https://www.virtualbox.org/download/oracle_vbox_2016.asc | apt-key add - && \
echo "deb http://download.virtualbox.org/virtualbox/debian xenial contrib" >> /etc/apt/sources.list.d/virtualbox.list && \
apt-get update && \
apt-get install -y \
virtualbox-5.0 \
&& rm -rf /var/lib/apt/lists/*
构建图像容器
docker build -t myVirtualbox。
我使用
启动了容器docker run -it -v /dev/vboxdrv:/dev/vboxdrv --privileged=true myVirtualbox bash
我在容器内部下载了docker-machine
curl -L https://github.com/docker/machine/releases/download/v0.7.0/docker-machine-`uname -s`-`uname -m` -o docker-machine && chmod +x docker-machine
然后我跑了
./docker-machine create --driver=virtualbox default
这是错误
(default) Starting the VM...
(default) Check network to re-create if needed...
Error creating machine: Error in driver during machine creation: Error setting up host only network on machine start: The host-only adapter we just created is not visible. This is a well known VirtualBox bug. You might want to uninstall it and reinstall at least version 5.0.12 that is is supposed to fix this issue
The default lines below are for a sh/bash shell, you can specify the shell you're using, with the --shell flag.
在容器中我有virtualBox版本5.0.26r108824