DOCKER 学习笔记7 Docker Machine 在阿里云实例化ECS 以及本地Windows 实例化虚拟机实战 (2)

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 连接后,这就和一个普通的主机没有什么区别了。

[root@mrclinux ~]# docker-machine ssh mrctest Last login: Tue Feb 11 18:06:17 2020 from xxxxxxxx Welcome to Alibaba Cloud Elastic Compute Service ! [root@mrctest ~]# docker version Client: Docker Engine - Community Version: 19.03.5 API version: 1.40 Go version: go1.12.12 Git commit: 633a0ea Built: Wed Nov 13 07:25:41 2019 OS/Arch: linux/amd64 Experimental: false Server: Docker Engine - Community Engine: Version: 19.03.5 API version: 1.40 (minimum version 1.12) Go version: go1.12.12 Git commit: 633a0ea Built: Wed Nov 13 07:24:18 2019 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.2.10 GitCommit: b34a5c8af56e510852c35414db4c1f4fa6172339 runc: Version: 1.0.0-rc8+dev GitCommit: 3e425f80a8c931f88e6d94a8c831b9d5aa481657 docker-init: Version: 0.18.0 GitCommit: fec3683 [root@mrctest ~]# exit logout 实例销毁

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-machine

git 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 同一文件夹下。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zgjzxf.html