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

  • Docker on Windows
  • Elton Stoneman
  • 473字
  • 2021-07-02 19:53:17

Docker for Windows

Docker for Windows is available from Docker Storenavigate to https://dockr.ly/docker-for-windows. You can choose between the Stable channel and the Edge channel. Both channels give you Docker CE, but the Edge channel follows the monthly release cycle, and you will get experimental features. The Stable channel follows the EE release cycle, with quarterly updates.

You should use the Edge channel in development if you want to work with the latest features. In test and production, you will use Docker EE, so you need to be careful that you don't use features in development that are not yet available in EE.

Download and run the installer. The installer will verify that you can run Docker in your setup and will configure the Windows features needed to support Docker. When Docker is running, you will see a whale icon in the notification bar, which you can click on for options:

You need to select Switch to Windows containers before you do anything else. Docker for Windows can run Linux containers by running Docker inside a Linux VM on your machine. That's great to test out Linux apps to see how they run in containers, but this book is all about Windows containers - switch over, and Docker will remember that setting in future.

While Docker for Windows is running, you can open Command Prompt or a PowerShell session and start working with containers. First, verify that everything is working as expected by running docker version. You should see output similar to this:

> docker version

Client:
Version: 17.06.0-ce
API version: 1.30
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 21:30:30 2017
OS/Arch: windows/amd64

Server:
Version: 17.06.0-ce
API version: 1.30 (minimum version 1.24)
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 22:19:00 2017
OS/Arch: windows/amd64
Experimental: true
The output tells you the version of the command-line client and the Docker service. The operating system field should read Windows for both; if not, then you may be in Linux mode, and you'll need to switch to Windows containers.

Now run a simple container:

docker container run dockeronwindows/ch01-whale

This uses a public image on Docker Cloudone of the sample images for this book, which Docker will pull the first time you use it. If you don't have any other images, this will take few minutes, as it will also download the Microsoft Nano Server image that my image uses as a base. When the container runs, it shows some ASCII art and then exits. Run the same command again, and you will see that it executes much more quickly as the images are now cached locally.

That's all the setup you need. Docker for Windows also contains the Docker Compose tool I'll be using later in the book, so you're all set to follow along with the code samples.

主站蜘蛛池模板: 禹州市| 安仁县| 万山特区| 馆陶县| 洱源县| 姜堰市| 马公市| 正阳县| 宁强县| 石家庄市| 宁陵县| 白河县| 永泰县| 聂荣县| 左云县| 开封市| 色达县| 观塘区| 南宫市| 兴国县| 惠州市| 扎囊县| 峨眉山市| 皋兰县| 疏勒县| 东阳市| 花莲市| 米泉市| 汝州市| 惠安县| 定襄县| 任丘市| 治多县| 油尖旺区| 高台县| 若羌县| 永仁县| 太仆寺旗| 定襄县| 沙田区| 南乐县|