使用docker-machine 創建virtualbox虛擬機時指定boot2docker.iso位置和設置docker鏡像加速的命令


使用docker-machine 創建virtualbox虛擬機時指定boot2docker.iso位置和設置docker鏡像加速的命令

docker-machine create -d virtualbox --virtualbox-boot2docker-url=/home/當前用戶/.docker/machine/cache/boot2docker2.iso --engine-registry-mirror=https://3qtk5f5j.mirror.aliyuncs.com node1

-d virtualbox為指定virtualbox創建虛擬機

-virtualbox-boot2docker-url=/home/當前用戶/.docker/machine/cache/boot2docker2.iso 指定 boot2docker.iso 文件並且可以跳過國內網絡不識別github最新版boot2docker.iso文件的問題

--engine-registry-mirror=https://3qtk5f5j.mirror.aliyuncs.com 可以直接在創建虛擬機的時候就將加速地址寫入,容器鏡像下載嗖嗖嗖嗖~

 1 zhoulei@zhoulei-PC:~/Desktop$ docker-machine create -d virtualbox --virtualbox-boot2docker-url=/home/zhoulei/.docker/machine/cache/boot2docker.iso --engine-registry-mirror=https://3qtk5f5j.mirror.aliyuncs.com node2
 2 Running pre-create checks...  3 (node2) Boot2Docker URL was explicitly set to "/home/zhoulei/.docker/machine/cache/boot2docker.iso" at create time, so Docker Machine cannot upgrade this machine to the latest version.
 4 Creating machine...
 5 (node2) Boot2Docker URL was explicitly set to "/home/zhoulei/.docker/machine/cache/boot2docker.iso" at create time, so Docker Machine cannot upgrade this machine to the latest version.
 6 (node2) Downloading /home/zhoulei/.docker/machine/cache/boot2docker.iso from /home/zhoulei/.docker/machine/cache/boot2docker.iso...
 7 (node2) Creating VirtualBox VM...
 8 (node2) Creating SSH key...
 9 (node2) Starting the VM...
10 (node2) Check network to re-create if needed...
11 (node2) Waiting for an IP...
12 Waiting for machine to be running, this may take a few minutes...
13 Detecting operating system of created instance...
14 Waiting for SSH to be available...
15 Detecting the provisioner...
16 Provisioning with boot2docker...
17 Copying certs to the local machine directory...
18 Copying certs to the remote machine...
19 Setting Docker configuration on the remote daemon...
20 Checking connection to Docker...
21 Docker is up and running!
22 To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: docker-machine env node2

 

 

 
 1 zhoulei@zhoulei-PC:~/Desktop$ docker-machine ssh node2 "docker pull ubuntu"
 2 Using default tag: latest
 3 latest: Pulling from library/ubuntu
 4 5667fdb72017: Pulling fs layer
 5 d83811f270d5: Pulling fs layer
 6 ee671aafb583: Pulling fs layer
 7 7fc152dfb3a6: Pulling fs layer
 8 7fc152dfb3a6: Waiting
 9 ee671aafb583: Verifying Checksum
10 ee671aafb583: Download complete
11 d83811f270d5: Verifying Checksum
12 d83811f270d5: Download complete
13 7fc152dfb3a6: Verifying Checksum
14 7fc152dfb3a6: Download complete
15 5667fdb72017: Verifying Checksum
16 5667fdb72017: Download complete
17 5667fdb72017: Pull complete
18 d83811f270d5: Pull complete
19 ee671aafb583: Pull complete
20 7fc152dfb3a6: Pull complete
21 Digest: sha256:b88f8848e9a1a4e4558ba7cfc4acc5879e1d0e7ac06401409062ad2627e6fb58
22 Status: Downloaded newer image for ubuntu:latest
23 docker.io/library/ubuntu:latest
24 zhoulei@zhoulei-PC:~/Desktop$ docker-machine ssh node2 "docker image ls"
25 REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
26 ubuntu              latest              2ca708c1c9cc        3 weeks ago         64.2MB
27 zhoulei@zhoulei-PC:~/Desktop$ 

可以看到鏡像已經下載下來了


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM