docker-machine error to create default machine

2019-05-31 11:36发布

问题:

I'm trying to use docker-machine and virtualbox inside a container.

The host: Ubuntu 16.04

I installed in the host

sudo apt-get install linux-headers-generic virtualbox-dkms

The Dockerfile definition

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/*

Builded the image container

docker build -t myVirtualbox .

I started the container using

docker run -it -v /dev/vboxdrv:/dev/vboxdrv --privileged=true myVirtualbox bash

Inside the container I downloaded the 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

Then I ran

./docker-machine create --driver=virtualbox default

This is the error

(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.

In the container I have the virtualBox version 5.0.26r108824