Creating and Managing Dockerized Hosts with Docker‑Machine
This article explains how to set up Dockerized hosts using Docker‑Machine on Windows, covers driver options, environment configuration, and demonstrates building, publishing, and running a .NET Core application in containers on both local and cloud platforms.
The concept of a Dockerized Host refers to a machine with the Docker engine installed, enabling container management for development, testing, and production, and allowing standardized migration of applications across environments.
Using containers separates applications from their dependencies, OS, and servers, simplifying automation, improving resource utilization, and reducing the complexity of CI/CD pipelines.
To create a Dockerized host on Windows, install Docker for Windows and run the following command with administrator rights: docker-machine create --driver hyperv {machine-name} If the required boot2docker.iso is missing, Docker‑Machine will download it automatically; you can also manually place it in ~\.docker\machine\cache\.
After creation, configure your shell to point Docker commands at the new host:
@FOR /f "tokens=*" %i IN ('docker-machine env {machine-name}') DO @%iThis sets the environment variables:
SET DOCKER_TLS_VERIFY=1
SET DOCKER_HOST=tcp://xxx.xxx.xxx.xxx:2376
SET DOCKER_CERT_PATH=C:\Users\LeiXu\.docker\machine\machines\{machine-name}
SET DOCKER_MACHINE_NAME={machine-name}Docker‑Machine supports many drivers for different platforms, such as VirtualBox, Hyper‑V, Azure, AWS (amazonec2), VMware Fusion, and others. Full driver list is available at the Docker documentation.
Example commands for specific clouds:
docker-machine create --driver azure --azure-subscription-id {sub-id} --azure-open-port 80 {machine-name} docker-machine create --driver azure --azure-environment "AzureChinaCloud" --azure-subscription-id {sub-id} --azure-open-port 80 --azure-location "ChinaNorth" {machine-name} docker-machine create --driver amazonec2 --amazonec2-region "ap-northeast-1" --amazonec2-vpc-id {vpc-id} {machine-name}After hosts are created you can list them with docker-machine ls, SSH into a host with docker-machine ssh {machine-name}, or regenerate certificates if connectivity issues arise: docker-machine regenerate-certs {machine-name} Docker‑Machine lets you create, start, and stop container hosts without using cloud provider consoles, making the local Docker environment a unified control plane for development, testing, and production.
To publish an application, run the provided DockerTask.ps1 script from the project directory:
.\DockerTask.ps1 -Build -Environment Release -Machine {machine-name}After the image is built and pushed, verify it with docker images and run the container: docker run -p 80:80 username/webapp01:latest If you encounter Docker version mismatches, install Docker Version Manager (dvm) and select the appropriate version:
dvm install {version}
dvm use {version}Installation command (PowerShell):
Invoke-WebRequest https://download.getcarina.com/dvm/latest/install.ps1 -UseBasicParsing | Invoke-ExpressionIn summary, the guide walks through creating local and cloud Docker environments, managing hosts with Docker‑Machine, and performing a simple .NET Core application build, image upload, and container deployment, laying the groundwork for more advanced DevOps workflows.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
DevOps
Share premium content and events on trends, applications, and practices in development efficiency, AI and related technologies. The IDCF International DevOps Coach Federation trains end‑to‑end development‑efficiency talent, linking high‑performance organizations and individuals to achieve excellence.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
