Docker Machine
docker三劍客
GITEE映射的GITHUB的Docker-Machine的地址
Docker machine搭建遇到的問題:Error with pre-create check: “VBoxManage not found. Make sure VirtualBox is
docker machine
寫的很不錯?
1.簡介
Docker Machine是Docker官方三劍客項目之一,負責使用Docker的第一步,在多種平臺上快速安裝Docker環境。它支持多種平臺,讓用戶可以在很短時間內搭建一套Docker主機集群。
Machine項目主要由Go編寫,用戶可以在本地任意指定被Machine管理的Docker主機,并對其進行操作。Machine定位是“在本地或者云環境中創建Docker主機(Create Docker hosts on your computer,on cloud providers,and inside your own data center.)”。
其基本功能包括:
·在指定節點上安裝Docker引擎,配置其為Docker主機;
·集中管理所有Docker主機。
Machine連接不同類型的節點是通過不同驅動指定的,目前已經支持了包括IBM、Amazon、Google等多家數據中心的云主機。
2.安裝
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-machine3.通過VirtualBox來創建的例子
3.1 報錯VBoxManage not found
Make sure VirtualBox is installed and VBoxManage is in the path
安裝virtualbox
3.2?This computer doesn't have VT-X/AMD-v enabled.
[root@wknode doc]# docker-machine create --driver=virtualbox vbox-instance Running pre-create checks... Error with pre-create check: "This computer doesn't have VT-X/AMD-v enabled. Enabling it in the BIOS is mandatory"解決方案:
3.3 成功創建一個虛擬機器并為其安裝docker環境
[root@wknode muten003]# docker-machine create --driver=virtualbox vbox-instance Running pre-create checks... Creating machine... (vbox-instance) Copying /root/.docker/machine/cache/boot2docker.iso to /root/.docker/machine/machines/vbox-instance/boot2docker.iso... (vbox-instance) Creating VirtualBox VM... (vbox-instance) Creating SSH key... (vbox-instance) Starting the VM... (vbox-instance) Check network to re-create if needed... (vbox-instance) Waiting for an IP... Waiting for machine to be running, this may take a few minutes... Detecting operating system of created instance... Waiting for SSH to be available... Detecting the provisioner... Provisioning with boot2docker... Copying certs to the local machine directory... Copying certs to the remote machine... Setting Docker configuration on the remote daemon... Checking connection to Docker... Docker is up and running! To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: docker-machine env vbox-instance [root@wknode muten003]# docker-machine env vbox-instance export DOCKER_TLS_VERIFY="1" export DOCKER_HOST="tcp://192.168.99.100:2376" export DOCKER_CERT_PATH="/root/.docker/machine/machines/vbox-instance" export DOCKER_MACHINE_NAME="vbox-instance" # Run this command to configure your shell: # eval $(docker-machine env vbox-instance)?3.4 遠程登錄被剛剛創建的虛擬機器
[root@wknode muten003]# docker-machine ssh vbox-instance( '>')/) TC (\ Core is distributed with ABSOLUTELY NO WARRANTY.(/-_--_-\) www.tinycorelinux.net vim /etc/ssh/sshd_config將PermitRootLogin yes的注釋放開,sudo systemctl restart sshd [root@wknode cppHelloWorld]# docker-machine create --driver generic --generic-ip-address=192.168.244.142 node-work Docker machine "node-work" already exists [root@wknode cppHelloWorld]#3.5 切換環境查看被控制機器的情況
[root@wknode muten003]# docker-machine env vbox-instance export DOCKER_TLS_VERIFY="1" export DOCKER_HOST="tcp://192.168.99.100:2376" export DOCKER_CERT_PATH="/root/.docker/machine/machines/vbox-instance" export DOCKER_MACHINE_NAME="vbox-instance" # Run this command to configure your shell: # eval $(docker-machine env vbox-instance) [root@wknode muten003]# [root@wknode muten003]# eval $(docker-machine env vbox-instance) [root@wknode muten003]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE3.6 將環境切換回docker-machine所在機器
[root@wknode muten003]# docker-machine env -u unset DOCKER_TLS_VERIFY unset DOCKER_HOST unset DOCKER_CERT_PATH unset DOCKER_MACHINE_NAME # Run this command to configure your shell: # eval $(docker-machine env -u) [root@wknode muten003]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE [root@wknode muten003]# [root@wknode muten003]# eval $(docker-machine env -u) [root@wknode muten003]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE java-image latest 46591cb26793 11 hours ago 584MB ubuntu 14.04 61319561d377 13 hours ago 215MB test 0.1 5d356f548ba9 14 hours ago 197MB 192.168.244.142:8443/library/redis latest 87c26977fd90 12 days ago 113MB 192.168.244.142:8443/library/redis v3.0.0 87c26977fd90 12 days ago 113MB 192.168.244.142:8443/library/redis v4.0.0 87c26977fd90 12 days ago 113MB redis latest 87c26977fd90 12 days ago 113MB ubuntu latest ff0fea8310f3 12 days ago 72.8MB4.Machine架構圖
總結
以上是生活随笔為你收集整理的Docker Machine的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【源码级】butterfly魔改
- 下一篇: 电脑技术员联盟Ghost Xp Sp3纯