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

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.

主站蜘蛛池模板: 昌图县| 乌拉特前旗| 芷江| 大姚县| 新干县| 兖州市| 襄城县| 鄯善县| 武宣县| 临夏县| 正蓝旗| 海淀区| 时尚| 乐至县| 柳林县| 毕节市| 拜泉县| 德阳市| 康乐县| 藁城市| 闸北区| 武陟县| 隆尧县| 卫辉市| 昌邑市| 太原市| 于都县| 屏山县| 兴仁县| 彭州市| 屏山县| 罗山县| 诏安县| 大连市| 灵山县| 林芝县| 雅安市| 广东省| 闽侯县| 钟祥市| 绩溪县|