docker建立本地主機例項Virtualbox 驅動出錯
宿主機系統:Centos7 64位
建立主機例項Virtualbox 命令:docker-machine create -d virtualbox test
連線centos工具:Finalshell 3.9.2.2
(docke疑難雜症,自學筆記)
錯誤點1:Error with pre-create check: "VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path"(如圖所示)
解決方法:
1.在/etc/yum.repos.d/目錄下新建virtualbox.repo並寫入如下內容
[virtualbox]
name=Oracle Linux / RHEL / CentOS-$releasever / $basearch - VirtualBox
baseurl=http://download.virtualbox.org/virtualbox/rpm/el/$releasever/$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://www.virtualbox.org/download/oracle_vbox.asc
2.更新yum快取
yum clean all
yum makecache
3.安裝virtualbox
yum install VirtualBox-5.1
此時再次執行建立主機例項Virtualbox 命令:docker-machine create -d virtualbox manager,新的錯誤出現:
錯誤點2:
Error with pre-create check: "We support Virtualbox starting with version 5. Your VirtualBox install is \"WARNING: The vboxdrv kernel module is not loaded. Either there is no module\\n available for the current kernel (3.10.0-1160.31.1.el7.x86_64) or it failed to\\n load. Please recompile the kernel module and install it by\\n\\n sudo /sbin/vboxconfig\\n\\n You will not be able to start VMs until this problem is fixed.\\n5.1.38r122592\". Please upgrade at https://www.virtualbox.org"
解決方法:
1.檢查virtualbox安裝配置
輸入/sbin/vboxconfig,出現提示:
2.按提示安裝核心模組(系統擴充套件):
yum install gcc make
yum install kernel-devel-3.10.0-1160.31.1.e17.x86_64
3.安裝完成,驗證效果:
錯誤點3:Error with pre-create check: "This computer doesn't have VT-X/AMD-v enabled. Enabling it in the BIOS is mandatory"
解決方法:
1.poweroff關機後配置虛擬機器:
2.開機後,下載boot2docker.iso放在/root/.docker/machine/cache目錄下
(boot2docker.iso下載網址https://github.com/boot2docker/boot2docker/releases/)
3.執行docker-machine create -d virtualbox manager命令:
(此時虛擬機器記憶體設定為4G,實際用量達1.4G,剛開始設定1G時執行不起來)
4.建立主機成功後, 可以通過 env 命令來讓後續操作物件都是⽬標主機
docker-machine env test
5.SSH 登入到主機
docker-machine ssh test