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

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.

主站蜘蛛池模板: 铜梁县| 荣昌县| 赣州市| 会泽县| 潞城市| 闽侯县| 达州市| 沙雅县| 凌源市| 建始县| 错那县| 武安市| 大安市| 金华市| 灯塔市| 兴和县| 江源县| 康保县| 文安县| 容城县| 札达县| 惠州市| 胶南市| 乌拉特前旗| 孝感市| 婺源县| 通辽市| 乌兰县| 万年县| 襄樊市| 荃湾区| 定远县| 沿河| 博爱县| 尼勒克县| 临安市| 澄江县| 巴彦淖尔市| 东源县| 安塞县| 洛隆县|