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

Docker Desktop

Docker Desktop is available from Docker Hub – you can find it by navigating to https://dockr.ly/docker-for-windows. You can choose between the Stable channel and the Edge channel. Both channels give you the community Docker Engine, but the Edge channel follows the monthly release cycle, and you will get experimental features. The Stable channel tracks the Docker Engine 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 Enterprise, so you need to be careful that you don't use features in development, which are not yet available in Enterprise. Docker recently announced Docker Desktop Enterprise, which lets developers run the exact same engine locally as their organization is running in production.

You need to 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 right-click on for options:

You need to select Switch to Windows containers... before you do anything else. Docker Desktop on Windows can run Linux containers by running Docker inside a Linux VM on your machine. This is great for testing out Linux apps to see how they run in containers, but this book is all about Windows containers – so switch over, and Docker will remember this 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 an output similar to this code snippet:

> docker version

Client: Docker Engine - Community
Version: 18.09.2
API version: 1.39
Go version: go1.10.8
Git commit: 6247962
Built: Sun Feb 10 04:12:31 2019
OS/Arch: windows/amd64
Experimental: false

Server: Docker Engine - Community
Engine:
Version: 18.09.2
API version: 1.39 (minimum version 1.24)
Go version: go1.10.6
Git commit: 6247962
Built: Sun Feb 10 04:28:48 2019
OS/Arch: windows/amd64
Experimental: true
The output tells you the version of the command-line client and the Docker Engine. The operating system field should read Windows for both; if not, then you may still be in Linux mode, and you'll need to switch to Windows containers.

Now run a simple container with the Docker CLI:

docker container run dockeronwindows/ch01-whale:2e

This uses a public image on Docker Hub – one 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 a few minutes, as it will also download the Microsoft Nano Server image, which 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.

Docker Desktop checks for updates when it starts and will prompt you to download a new version when it's ready. You can keep your Docker tools up to date just by installing new versions when they're released. You can check the current versions you have installed by selecting About Docker Desktop from the taskbar menu:

That's all the setup you need. Docker Desktop 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.

主站蜘蛛池模板: 龙山县| 石首市| 梨树县| 襄垣县| 海淀区| 博客| 合作市| 资兴市| 陵川县| 通江县| 昌吉市| 罗城| 广昌县| 泸溪县| 湘潭县| 襄汾县| 广宁县| 塘沽区| 长丰县| 永安市| 洛扎县| 徐水县| 丽水市| 南溪县| 明水县| 盐边县| SHOW| 曲周县| 阳新县| 张北县| 香格里拉县| 桦甸市| 大丰市| 卢湾区| 高邮市| 德惠市| 凤台县| 延吉市| 达拉特旗| 鸡东县| 栾城县|