官术网_书友最值得收藏!

Docker in an Azure VM

Microsoft makes it easy to run Docker in Azure. They provide a VM image with Docker installed and configured and with the base Windows images already pulled so you can get started quickly.

For testing and exploring, I always use DevTest labs in Azure. It's a great feature for non-production environments. By default, any VMs you create in a DevTest lab will be turned off every evening, so you don't end up with a big Azure bill from a VM you used for a few hours and forgot to turn off.

You can create a DevTest Lab through the Azure Portal and then create a VM from Microsoft's VM image Windows Server 2016 Datacenter - with Containers. As an alternative to the Azure Portal, you can use the az command-line to manage the DevTest lab. I've packaged az in a Docker image, which you can run in a Windows container:

docker run -it dockeronwindows/ch01-az

This runs an interactive Docker container that has the az command packaged and ready to use. Run az login, and you'll need to open a browser and authenticate the Azure CLI. Then, you can run this in the container to create a VM:

az lab vm create `
--lab-name docker-on-win --resource-group docker-on-winRG236992 `
--name dow-vm-01 `
--image 'Windows Server 2016 Datacenter - with Containers' `
--image-type gallery --size Standard_DS2 `
--admin-username 'elton' --admin-password 'S3crett20!7'

The VM uses the full Windows Server 2016 installation with the UI, so you can connect to the machine with RDP, open a PowerShell cmdlet, and start using Docker right away. Just like the other options, you can check whether Docker is running with docker version and then run a container from the sample image for this chapter:

docker container run dockeronwindows/ch01-whale

If an Azure VM is your preferred option, you can follow the steps from the previous section to secure the Docker API for remote access. This way, you can run the Docker command-line on your laptop to manage containers on the cloud.

主站蜘蛛池模板: 华池县| 金溪县| 团风县| 黎川县| 滨州市| 栾川县| 栖霞市| 高邮市| 林甸县| 大石桥市| 西丰县| 读书| 岐山县| 同德县| 马龙县| 孝感市| 石门县| 呼伦贝尔市| 大新县| 赤壁市| 石城县| 连云港市| 山西省| 彭州市| 葫芦岛市| 南雄市| 维西| 巴塘县| 南通市| 石阡县| 鄂托克前旗| 盱眙县| 凭祥市| 岳普湖县| 高安市| 安塞县| 高雄县| 珲春市| 乐陵市| 马关县| 华亭县|