點擊Docker Quickstart Terminal 後屏幕顯示如下:
bash: vmrun.exe: command not found
Running pre-create checks...
Creating machine...
(default) Copying C:\Users\hp\.docker\machine\cache\boot2docker.iso to C:\Users\hp\.docker\machine\machines\default\boot2docker.iso...
(default) Creating SSH key...
(default) Creating VM...
(default) Creating disk 'C:\Users\hp\.docker\machine\machines\default\default.vmdk'
(default) Virtual disk creation successful.
(default) Starting default...
(default) Waiting for VM to come online...
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: C:\d_my_virtualMachine\Docker Toolbox\docker-machine.exe env default
出了這個問題是因爲它找不到 vmrun.exe命令,也就找不到啓動的docker系統文件,只好重新創建一個(把之前的系統刪除了)docker系統以供使用。
原因就在於我之前做了一些修改,其中就包含了修改docker的啓動文件:start.sh
老師建議對這類情況使用vmware workstation 打開 C:\Users\hp.docker\machine\machines\default\default.vmx 然後在裏面輸入ifconfig | more ,
記錄下eth0 的ip,(docker IP)用secureCRT連接該docker IP即可使用。
其實secureCRT和Docker Quickstart Terminal 其實相當於可做人機交互的客戶端(類似電腦顯示的人機交互界面),背後連接使用的是docker系統(電腦操作系統),vmware workstation 作系統運作的載體(類似電腦的硬件)。
vmware打開docker報錯:operation system no found
備註:我之前試過修改start.sh 的export路徑,再用vmware workstation開啓docker系統default,屢次報錯:
最後是把原本的start.sh還原爲最初複製粘貼別人正確的代碼並移除了default後再次並打開default才正確啓動。也許我之前的路徑更改嘗試並沒有錯,只是要讓系統能識別並運行更改後的文件,還是要移除default後再次打開。
Docker Toolbox\start.sh 裏的正確代碼(export PATH要符合自己的路徑,其餘的複製粘貼即可,要用vmware運行docker就要這麼做):
#!/bin/bash
export PATH="$PATH:/c/Program Files (x86)/VMware/VMware Workstation"
trap '[ "$?" -eq 0 ] || read -p "Looks like something went wrong in step ´$STEP´... Press any key to continue..."' EXIT
VM=${DOCKER_MACHINE_NAME-default}
DOCKER_MACHINE=./docker-machine.exe
BLUE='\033[1;34m'
GREEN='\033[0;32m'
NC='\033[0m'
if [ ! -f "${DOCKER_MACHINE}" ]; then
echo "Docker Machine is not installed. Please re-run the Toolbox Installer and try again."
exit 1
fi
vmrun.exe list | grep "${VM}" &> /dev/null
VM_EXISTS_CODE=$?
set -e
STEP="Checking if machine $VM exists"
if [ $VM_EXISTS_CODE -eq 1 ]; then
"${DOCKER_MACHINE}" rm -f "${VM}" &> /dev/null || :
rm -rf ~/.docker/machine/machines/"${VM}"
#set proxy variables if they exists
if [ -n ${HTTP_PROXY+x} ]; then
PROXY_ENV="$PROXY_ENV --engine-env HTTP_PROXY=$HTTP_PROXY"
fi
if [ -n ${HTTPS_PROXY+x} ]; then
PROXY_ENV="$PROXY_ENV --engine-env HTTPS_PROXY=$HTTPS_PROXY"
fi
if [ -n ${NO_PROXY+x} ]; then
PROXY_ENV="$PROXY_ENV --engine-env NO_PROXY=$NO_PROXY"
fi
"${DOCKER_MACHINE}" create -d vmwareworkstation $PROXY_ENV "${VM}"
fi
STEP="Checking status on $VM"
VM_STATUS="$(${DOCKER_MACHINE} status ${VM} 2>&1)"
if [ "${VM_STATUS}" != "Running" ]; then
"${DOCKER_MACHINE}" start "${VM}"
yes | "${DOCKER_MACHINE}" regenerate-certs "${VM}"
fi
STEP="Setting env"
eval "$(${DOCKER_MACHINE} env --shell=bash ${VM})"
STEP="Finalize"
clear
cat << EOF
## .
## ## ## ==
## ## ## ## ## ===
/"""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\_______/
EOF
echo -e "${BLUE}docker${NC} is configured to use the ${GREEN}${VM}${NC} machine with IP ${GREEN}$(${DOCKER_MACHINE} ip ${VM})${NC}"
echo "For help getting started, check out the docs at https://docs.docker.com"
echo
cd
docker () {
MSYS_NO_PATHCONV=1 docker.exe "$@"
}
export -f docker
if [ $# -eq 0 ]; then
echo "Start interactive shell"
exec "$BASH" --login -i
else
echo "Start shell with command"
exec "$BASH" -c "$*"
fi
參考:
總的來說我是通過用vmware workstation 打開docker系統default,再用secureCRT連接docker系統才解決了docker無法保存鏡像的問題。secureCRT是企業常用的,方便操作docker