创建前检查出错:"找不到 VBoxManage。请确保已安装 VirtualBox 并且 VBoxManage 在路径中。"

50

我在Windows7上运行VirtualBox,其中安装了CentOS。现在在CentOS中我安装了Docker并需要运行

docker-machine create --driver virtualbox host1

但是我遇到了错误

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

那我是不是需要再次安装VirtualBox和在CentOS中安装它?如果是的话,我该怎么做?

非常感谢

12个回答

0

另外,如果您在虚拟机上安装了virtualbox和vboxmanage,但仍然遇到相同的错误:

请确保您的用户属于docker组。否则,您将以root身份运行docker,以用户身份运行vbox,它们无法相互识别。如果您需要使用sudo docker命令,则说明您不在该组中:

sudo docker images

解决方法:

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

现在检查用户是否已添加:

getent group docker

或者:

grep /etc/group -e "docker"

同时重启 Docker 守护进程:

sudo service docker restart 

退出终端并重新登录(如果这样不起作用,请尝试重新启动系统),然后您应该能够在不使用sudo的情况下运行docker,例如:

docker images

现在docker machine和docker-compose也应该可以运行了。

更多信息,请参考此答案:无法从docker-compose连接到docker


0

按照以下步骤安装Docker-Swarm:

$ 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"

出现错误的步骤:

$ 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  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   623  100   623    0     0   1236      0 --:--:-- --:--:-- --:--:--  1238
100 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 version
docker-machine.exe version 0.16.0, build 702c****
$ docker-machine ls
NAME   ACTIVE   DRIVER   STATE   URL   SWARM   DOCKER   ERRORS

$ docker-machine create --driver virtualbox manager1
Creating CA: C:\Users\*****\.docker\machine\certs\ca.pem
Creating client certificate: C:\Users\*****\.docker\machine\certs\cert.pem
Running pre-create checks...
Error with pre-create check: "VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path"

解决方案:

然后我从以下链接安装了VM:安装VirtualBox 下载VirtualBox和相应的扩展包:https://www.virtualbox.org/wiki/Downloads 使用默认设置安装VirtualBox 将扩展包添加到VirtualBox中(文件 -> 首选项 -> 扩展)

$ docker-machine create --driver virtualbox manager1
Running 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)"

最后,使用以下命令创建它:

$ docker-machine create --driver virtualbox  --virtualbox-no-vtx-check manager1
Running 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...

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接