The container is actually very fast, especially in the familiar Windows environment. The beginning is nothing more than a few things:
1, install container Feature, container function role
You can use the UI, and of course you can use PowerShell:
Install-windowsfeature containers
Restart-computer-force
Because the container itself can run on a physical machine or virtual machine, you can also install Hyper-V in the same way.
2. Installing Docker
You can use PowerShell to pull the Docker engine:
Invoke-webrequest "Https://get.docker.com/builds/Windows/x86_64/docker-1.12.1.zip"-outfile "$env: temp\ Docker-1.12.1.zip "–usebasicparsing
Default decompression to C:\Program Files\docker
Expand-archive-path "$env: Temp\docker-1.12.1.zip"-destinationpath $env:P rogramfiles
Of course, your hand to use the browser what the Https://get.docker.com/builds/Windows/x86_64/docker-1.12.1.zip downloaded their own decompression is no problem.
Then you configure the environment variables for the path:
If this is a temporary test, you can use:
$env:p ath + = "; C:\Program Files\docker"
The following PowerShell commands can be continued immediately.
If you want to use it later, then:
[Environment]::setenvironmentvariable ("Path", $env:P ath + "; C:\Program Files\docker ", [Environmentvariabletarget]::machine)
Re-open PowerShell.
Of course, you can also use the traditional cmd Set path= .... To configure.
The next step is to register the Docker Deamon service, and then start the Docker service.
Dockerd--register-service
Start-service Docker
3. Install Basic container image
This is actually the OS image mentioned earlier in the installation. Windows Server 2016 already supports Docker pull and push, so you can take OS images directly from the Docker hub.
Docker Pull Microsoft/windowsservercore
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/87/C8/ Wkiom1fhrd6dxwk-aab8ub2dlsg870.png "" 646 "height=" 168 "/>
Of course, you have to connect to the Internet. Wait patiently after the download is over, you can use Docker images to view the current host's existing mirrors.
The downloaded image is default to the program Data directory:
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M00/87/C5/wKioL1fhRd_ Q1q72aadt9rcrlrk070.png "" 640 "height=" 263 "/>
Under the very long UUID directory, there are files, hives and other directories.
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M01/87/C8/wKiom1fhRd_ I7a1naacy1dfgoyo048.png "" 639 "height=" 262 "/>
There is also a blank virtual disk. In this way, the operating system files, registry, and so on can be sandboxed operation.
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/87/C8/ Wkiom1fhredhfmceaaeemaj9ovw081.png "" 642 "height=" 167 "/>
You can also pull a nanoserver mirror.
4. Deploy container Mirroring
Container mirroring that can run on Windows Server Core or nano Server is basically viewable on Microsoft registry and can be seen directly on the Docker hub.
https://hub.docker.com/r/microsoft/#
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/87/C8/ Wkiom1fhregcnmfjaadhb-n37r4238.png "" 645 "height=" 387 "/>
Of course, you can also use the Docker command to find:
Docker Search Microsoft
We might as well grab an IIS to play with.
Docker Pull Microsoft/iis
Once you're done, you can run this container image with Docker.
Docker run-d-P 80:80 microsoft/iis ping-t localhost
This command line is easy to understand, as a background service runs an IIS container that maps an external 80 port to port 80 of IIS inside the container. The container runs an attachment command line of ping–t localhost.
Why run the extra ping–t localhost? This is because the IIS container without any process quickly kills itself by ending the process, using this to keep the container running:
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/87/C5/wKioL1fhReKQEJlzAACU_ Urqgy4312.png "" 640 "height=" 167 "/>
How do you kill this container?
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/87/C5/ Wkiol1fhreoyoavzaaevmgbh9kg419.png "" 642 "height=" 167 "/>
For more command-line arguments, refer to Docker reference:
https://docs.docker.com/engine/reference/run/
Sip the Windows Server 2016--container container: Deploy