Jenkins no Docker não tem acesso a / dev / vboxnetctl para o VirtualBox

0

Estou tentando configurar o Jenkins (executado no Docker; imagem oficial) que é executado como usuário "jenkins". E o Jenkins deve iniciar uma máquina virtual usando o docker-machine e o virtualbox.

Eu liguei / dev / vboxnetctl no contêiner do jenkins. E eu também tentei usar o sudo para rodar o docker-machine como root.

Mas o usuário jenkins não tem acesso ao / dev / vboxnetctl:

$ docker-compose exec jenkinsmaster sudo docker-machine create test
Creating CA: /root/.docker/machine/certs/ca.pem
Creating client certificate: /root/.docker/machine/certs/cert.pem
Running pre-create checks...
(test) Image cache directory does not exist, creating it at /root/.docker/machine/cache...
(test) No default Boot2Docker ISO found locally, downloading the latest release...
(test) Latest release for github.com/boot2docker/boot2docker is v17.09.0-ce
(test) Downloading /root/.docker/machine/cache/boot2docker.iso from https://github.com/boot2docker/boot2docker/releases/download/v17.09.0-ce/boot2docker.iso...
(test) 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100%
Creating machine...
(test) Copying /root/.docker/machine/cache/boot2docker.iso to /root/.docker/machine/machines/test/boot2docker.iso...
(test) Creating VirtualBox VM...
(test) Creating SSH key...
(test) Starting the VM...
(test) Check network to re-create if needed...
(test) Creating a new host-only adapter produced an error: /usr/bin/VBoxManage hostonlyif create failed:
(test) 0%...
(test) Progress state: NS_ERROR_FAILURE
(test) VBoxManage: error: Failed to create the host-only adapter
(test) VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: Operation not permitted
(test) VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterfaceWrap, interface IHostNetworkInterface
(test) VBoxManage: error: Context: "RTEXITCODE handleCreate(HandlerArg*)" at line 71 of file VBoxManageHostonly.cpp
(test) 
(test) This is a known VirtualBox bug. Let's try to recover anyway...
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

Como fazer isso funcionar?

    
por Michael 18.10.2017 / 16:12

0 respostas