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 [email protected]:~/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 [email protected]:~/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 [email protected]:~/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 [email protected]:~/Desktop$
可以看到镜像已经下载下来了
原文地址:https://www.cnblogs.com/top66zhoulei/p/11664137.html
时间: 2024-11-04 07:40:09