ECS_REGION 购买区域 ?
这个若没有要求则就不需要配置,若已经有服务器在指定的区域,那就配置,比如杭州就是cn-hangzhou 这个时候注意观察地址栏的编号:https://ecs-buy.aliyun.com/wizard?/postpay/cn-hangzhou
ECS_VPC_ID 专用网络节点 ?
要是已经有你已经买了服务器,就可以看到这些信息,就复制填写一样的,没有则不用配置这一个
注意:需要账户余额大于100 不然创建不成功!!!!
docker-machine create -d aliyunecs <name>
[root@mrclinux ~]# docker-machine create -d aliyunecs mrctest Running pre-create checks... Creating machine... (mrctest) mrctest | Creating key pair for instance ... (mrctest) mrctest | Configuring security groups instance ... (mrctest) mrctest | Creating instance with image centos_7_06_64_20G_alibase_20190711.vhd ... (mrctest) mrctest | Create instance i-xxxxxxxx successfully (mrctest) mrctest | Allocating Eip address for instance i-xxxxxxxx ... (mrctest) mrctest | Associating Eip address eip-bp1hc5mty4iz4dnlb3o9b for instance i-xxxxxxxx ... (mrctest) mrctest | Starting instance i-xxxxxxxx ... (mrctest) mrctest | Start instance i-xxxxxxxx successfully (mrctest) mrctest | Waiting SSH service xxxxxxxx is ready to connect ... (mrctest) mrctest | Uploading SSH keypair to xxxxxxxx ... (mrctest) mrctest | Created instance i-xxxxxxxx successfully with public IP address xxxxxxxx and private IP address xxxxxxxx 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 centos... 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 mrctest 查看实例列表docker-machine ls
[root@mrclinux ~]# docker-machine ls NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS mrctest - aliyunecs Running tcp://xxx.xxx.xxx.199:2376 v19.03.5 连接使用实例docker-machine ssh name
通过 SSH 连接后,这就和一个普通的主机没有什么区别了。
docker-machine rm <name>
[root@mrclinux ~]# docker-machine rm mrctest About to remove mrctest WARNING: This action will delete both local reference and remote instance. Are you sure? (y/n): y (mrctest) mrctest | Remove instance i-bp15uqp37s1r2ei0f5z5 ... (mrctest) mrctest | Deleting instance: i-bp15uqp37s1r2ei0f5z5 Successfully removed mrctest WINDOWS 10 版本 首先安装Docker-windows 版本请参见:https://blogs.chaobei.xyz/archives/docker6
下载Docker-machinegit https://github.com/docker/machine/releases
https://github.com/docker/machine/releases/download/v0.16.2/docker-machine-Windows-x86_64.exe
选择合适的版本进行下载,推荐使用迅雷,可以加速下载
配置docker-machine将下载后的文件重命名为docker-machine.exe 移到与Docker-Desktop 同一文件夹下。