i run CentOS in VirtualBox on physical Windows7. Now in centOS i have Docker and i need to run

docker-machine create --driver virtualbox host1

but i get error

Error with pre-create check: "VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path"

so do i need to install VirtualBox once again and in the CentOS? If yes, how can i do that?

thanks lot

12

Best Answer


Yes you are absolutely correct. You need to install VirtualBox first of all.

You can do it by running yum install virtualbox for CentOS or

sudo apt-get install virtualbox for Ubuntu

Do so and then run your code and you will be good to go

It's an issue with permissions. You've installed docker as sudo. You need to run

sudo docker-machine create --driver virtualbox host1

OR

sudo docker-compose up 

to get around this.

I faced the same error in Ubuntu 18.04 but I realized that I had installed docker-machine using command : sudo snap install docker.

However install docker-machine using :

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

Check your installation :

$ docker-machine version

Then install virtualbox using :

$sudo apt install virtualbox

Now you can create the docker-machine using the command :

$ docker-machine create --driver virtualbox dev

Hope this helps.

Being more specific about install VirtualBox on Mac Mojavi.

  1. After downloading the VirtualBox-6.0.6-130049-OSX.dmg, double-click to install

  2. Go to your applications folder and you will find the virtualbox.pkg like this:

    virtualbox.pkg

  3. Click on it to complete the installation.

  4. After install is complete, you should see VirtualBox in the applications folder like this:

    virtual box after installation completes

  5. Afterwards you should refresh your terminal and rerun your command.

    docker-machine create --driver virtualbox local-docker.

try to execute with superuser:

sudo docker-machine create -d virtualbox myvm1

For those who are using windows you can open the powershell command shell as an administrator and run the command below:

PS C:\Windows/system32> choco install virtualbox

if you don't have choco you can install it using this the command below:

PS C:\Windows/system32>

Set-ExecutionPolicy Bypass -Scope Process -Force; `iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

You just need to install the virtualbox :

sudo apt-get install virtualboxthen run this command:docker-machine create --driver virtualbox default
  1. Reinstalled virtualbox

sudo snap remove virtualbox && sudo snap install virtualbox

  1. Renamed VBoxManage to match casing

sudo ln -s /usr/local/bin/VBoxManage /usr/local/bin/vboxmanage

  1. Reinstall Docker Machine with the command below.
base=https://github.com/docker/machine/releases/download/v0.16.0 &&curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/tmp/docker-machine &&sudo mv /tmp/docker-machine /usr/local/bin/docker-machine &&chmod +x /usr/local/bin/docker-machine
  1. Confirm the version and save scripts to /etc/bash_completion.d or /usr/local/etc/bash_completion.d
base=https://raw.githubusercontent.com/docker/machine/v0.16.0for i in docker-machine-prompt.bash docker-machine-wrapper.bashdocker-machine.bashdosudo wget "$base/contrib/completion/bash/${i}" -P /etc/bash_completion.ddone
  1. Rerun the command.

docker-machine create --driver virtualbox host1

1) Reinstall Virtualbox ... you can use this code : sudo apt-get install virtualbox

2) sudo docker-machine create --driver virtualbox default

Doing installation of Docker-Swarm using below steps:

$ base=https://github.com/docker/machine/releases/download/v0.16.0 &&mkdir -p "$HOME/bin" &&curl -L $base/docker-machine-Windows-x86_64.exe > "$HOME/bin/docker-machine.exe" &&chmod +x "$HOME/bin/docker-machine.exe"

Steps with ERROR:

$ base=https://github.com/docker/machine/releases/download/v0.16.0$ mkdir -p "$HOME/bin"$ curl -L $base/docker-machine-Windows-x86_64.exe > "$HOME/bin/docker-machine.exe"% Total % Received % Xferd Average Speed Time Time Time CurrentDload Upload Total Spent Left Speed100 623 100 623 0 0 1236 0 --:--:-- --:--:-- --:--:-- 1238100 27.2M 100 27.2M 0 0 726k 0 0:00:38 0:00:38 --:--:-- 593k$ chmod +x "$HOME/bin/docker-machine.exe"$ docker-machine versiondocker-machine.exe version 0.16.0, build 702c****$ docker-machine lsNAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS$ docker-machine create --driver virtualbox manager1Creating CA: C:\Users\*****\.docker\machine\certs\ca.pemCreating client certificate: C:\Users\*****\.docker\machine\certs\cert.pemRunning pre-create checks...Error with pre-create check: "VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path"

Resolution:

Then I installed VM from below link:Install VirtualBoxDownload VirtualBox and the corresponding Extension Pack: https://www.virtualbox.org/wiki/DownloadsInstall VirtualBox with the default settingsAdd the Extension Pack to VirtualBox (File -> Preferences -> Extensions)

$ docker-machine create --driver virtualbox manager1Running pre-create checks...Error with pre-create check: "This computer is running Hyper-V. VirtualBox won't boot a 64bits VM when Hyper-V is activated. Either use Hyper-V as a driver, or disable the Hyper-V hypervisor. (To skip this check, use --virtualbox-no-vtx-check)"

Then finally its created with below command:

$ docker-machine create --driver virtualbox --virtualbox-no-vtx-check manager1Running pre-create checks...(manager1) Image cache directory does not exist, creating it at C:\Users\****\.docker\machine\cache...(manager1) No default Boot2Docker ISO found locally, downloading the latest release...(manager1) 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100%(manager1) Creating VirtualBox VM...(manager1) Creating SSH key...(manager1) Starting the VM...

Also, if you installed virtualbox and vboxmanage on VM and still getting the same error:

Make sure your user is in the docker group. Otherwise you run docker as root and vbox as user and they can't see each other. Telltale sign that you're not in the group is that you have to sudo docker commands, e.g.:

sudo docker images

To fix, do:

sudo groupadd dockersudo gpasswd -a <your-username> docker

Now check that user is added:

getent group docker

or:

grep /etc/group -e "docker"

Also restart docker daemon:

sudo service docker restart 

Log out and back into terminal (try restarting system if this does not work), and you should be able to run docker without sudo, e.g.:

docker images

docker machine and docker-compose should now run, too.

Fore more information, refer to this answer: Can't connect to docker from docker-compose

Run below commands:

  1. sudo apt-get install virtualbox To install virtual box and then.
  2. also make sure docker machine is installed. LINK
  3. docker-machine create --driver virtualbox default to create machine & link for the same