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

Running LCOW containers

By default, Docker Desktop for Windows hosts Linux containers using MobyLinuxVM, which provides a minimal, fully-functional environment for hosting Linux containers. This approach is meant only for development and testing purposes as it is not available on Windows Server. Windows Server currently has experimental support for LCOW and it is also possible to enable this feature in Docker Desktop.

To enable LCOW support in Docker Desktop, you have to enable experimental features in the Docker Daemon. Let's take a look:

  1. Open the Docker Desktop tray icon and select Settings.
  2. Navigate to the Daemon tab.

 

  1. Enable the Experimental features checkbox:

  1. Apply the changes. Docker Desktop will restart.

Open PowerShell and create a container that uses Linux as the base image by providing the --platform=linux parameter to docker run. In this example, we're creating a busybox container in interactive mode and starting a Bourne shell:

docker run --rm -it --platform=linux busybox /bin/sh
If the image exists in a version for one platform, it is not necessary to provide the  --platform parameter. After downloading the image, it is also no longer necessary to specify the --platform parameter to run the container.

After the container is started, the Bourne shell prompt will appear (/ #). Now, you can verify that you are indeed running inside a Linux container by using the uname command, which prints Linux kernel information:

uname -a

The following screenshot shows the output of the preceding command:

In a separate Powershell window, without closing the Bourne shell in the container, execute the docker inspect <containerId> command in order to verify that the container is indeed running using LCOW using Hyper-V isolation:

In this section, you learned how to install Docker Desktop for Windows tooling and how to verify its functionality, including running Linux containers on Windows. In the next section, you will learn how to approach building your first Windows container image with the help of Visual Studio Code.

主站蜘蛛池模板: 从江县| 白玉县| 林芝县| 石城县| 襄樊市| 黑山县| 无极县| 渝中区| 夏津县| 永清县| 思茅市| 南康市| 揭西县| 辽阳市| 宝兴县| 济南市| 陆良县| 望城县| 聂荣县| 武邑县| 十堰市| 中卫市| 临海市| 汕头市| 遵义县| 南投市| 鄂尔多斯市| 宁陵县| 大足县| 洱源县| 雅江县| 新乡市| 比如县| 湘乡市| 大邑县| 英德市| 汝州市| 伊春市| 尚义县| 黔西县| 红原县|