In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Docker how to use Machine to create Azure virtual host, I believe many inexperienced people are helpless about this, this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
Azure recommends that we organize resources through resource groups. For demonstration purposes, let's create a new resource group named nickcontainer to store the VM we're going to create:
There is nothing in the resource group yet.
Create Cloud Virtual Machine
Using Docker Machine, a create command can do it:
docker-machine create \ --driver azure \ --azure-environment AzurePublicCloud \ --azure-subscription-id xxxxxxxxxxxxxxxxxxxxxxxxxx \ --azure-location "East Asia" \ --azure-size Standard_A0 \ --azure-image canonical:UbuntuServer:16.04.0-LTS:latest \ --azure-ssh-user nick \ --azure-resource-group nickcontainer \ --azure-availability-set testvmtiggeras \ testvmtigger
For domestic Azure users, please change the parameter--azure-environment AzurePublicCloud to--azure-environment AzureChinaCloud.
Executing the above command will first verify that we have access to Azure for operations:
At this point, the execution process stops. The output in the above figure is very clear. You need to visit https://aka.ms/devicelogin in your browser and enter a Captcha:
Fill in the Captcha and continue:
Enter your subscription account and password here to complete the authentication:
At this point, the authentication process has been completed and you can close the browser. Go back to the command line just now and find that it has been executed again. The entire process takes a few minutes until the output reads as follows:
Let's look at the state of the virtual machine testvmtiger:
You are already in the "Running" state. Try connecting to Docker daemon:
You can see that the server-side version is 17.05.0-ce, which is much higher than the local client version.
Let's go back to Azure's portal and see what's newly created in the resource group:
I was shocked. Why are there so many things? In fact, students who have played Azure virtual machines know that when we create a virtual machine, we will create all the resources that the virtual machine depends on, such as storage, virtual networks, network security groups, availability sets, network cards, public IP addresses, and so on. It is sufficient to care only about two points here (the red box in the image above): first, the virtual machine was successfully created; and second, the region of all resources is in East Asia.
After a round of checking, we can confirm that the create command did its job well: it created the VM on Azure and installed the Docker environment. Let's explain the main parameters of the create command.
Details of parameters
--driver azure
The driver parameter tells Docker Machine that the object we're working on is on the Azure cloud and needs to be operated on using Azure-related interfaces.
--azure-environment AzurePublicCloud
In fact, there are multiple independent Azure cloud environments, such as domestic ones. This parameter is required to specify the specific Azure cloud environment. The default is Azure PublicCloud, which points to Azure International as we speak. To connect to the domestic version, you need to specify AzureChinaCloud.
--azure-subscription-id xxxxxxxxxxxxxxxxxxxxxxxxxx
This is the subscription ID associated with your account, and all operations within Azure depend on this ID.
--azure-location "East Asia"
Azure deploys many data centers around the world, and we can specify where resources are created through location. Of course, this location is closer to the user, the better, the domestic international version of the user to choose East Asia slightly better.
--azure-size Standard_A0
Azuer charges virtual machines according to different sizes (actually configurations). Standard_A0 selected in the demo looks like this:
Although the configuration is not high, it is enough for demo. MS offers a wide range of sizes to choose from, and if you want to create virtual machine instances for production environments, you may need to choose instances that cost tens to hundreds of dollars per month.
--azure-image canonical:UbuntuServer:16.04.0-LTS:latest
Mirrors of virtual machines are critical for production environments. The Demo uses an image of ubuntu server 16.04, although we can specify any virtual machine image supported by Azure here. This is much better than using only boot2docker drivers!
--azure-ssh-user nick
Users who can log in to virtual machines via SSH, let's try:
Log in directly as user nick successfully. In fact, Docker Machine has configured relevant information for this user to log in via secret key.
--azure-resource-group nickcontainer
The resource group to which the newly created resource belongs.
clear resource
Docker Machine can not only create virtual machines, but also manage virtual machines. Is management merely the ability to stop, start and restart? The answer is that there could be more functionality, but it would require driver support. For example, the rm command, for the azure driver, it can kill almost all the things that have just been created! Execute the following command:
$ docker-machine rm testvmtigger
This is a dangerous operation, so there will be a confirmation step, and then really kill the resources on Azure (except for the storage part):
After reading the above, do you know how to use Machine to create Azure virtual hosts in Docker? If you still want to learn more skills or want to know more related content, welcome to pay attention to the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.