Docker for Windows: how to create containers on the Microsoft OS

Docker for Windows allows you to create Docker containers on Windows Server or Windows 10. Find out everything you need to know about it: advantages of Docker for Windows, how to install it, how to create containers…

The Docker container management platform allows you to create, deploy and manage application containers. It is compatible with Linux, macOS, but also on Windows. In this folder, you will discover everything you need to know to use Docker for Windows.

Docker for Windows Server

Since Windows Server 2016, Windows has its own container technology based on Docker. However, in addition to this open source solution, Microsoft adds PowerShell command line support and allows more isolation through Nano Server and Hyper-V Containers.

Like many Windows Server features, Windows Containers can be installed via Windows Features Dialogue or via PowerShell. By using the OneGet PowerShell module, you will be able to install both Windows Containers and Docker functionality and you will only need a reboot to start using it. It will be also necessary to enable Hyper-V virtualization if you wish to use Hyper-V containers.

Docker for Windows 10

Docker is also compatible with Windows 10 Pro and Enterprise. In addition, Windows is currently the only platform that supports to run both Windows and Linux containers. For good reason, the containers share the same host kernel.

It is therefore possible for Windows to run Windows containers, but also Linux containers on a Linux virtual machine thanks to the virtualization offered by Hyper-V. It is nevertheless necessary to choose between Linux containers or Windows containers.

To install Docker on Windows, you must first activate Hyper-V on your machine. Alternatively, you can also choose VirtualBox. After activating the Containers via the Windows Features Dialog, you will be able to will be able to install and manage your Windows containers using PowerShell.

Then download the Docker Engine and the Docker client at this address, and install the basic images that you will need to configure for your application. As a basic image, Microsoft recommends the Nano Server : its low-footprint Cloud-oriented implementation.

How to create a container

Now let’s see how to create a first Docker for Windows container. In your taskbar, you should now find a new icon in the shape of a whale carrying containers. This is the Docker icon. By right-clicking on this icon, you can now choose to “switch to the Windows containers. .

To download and run your first Windows container, run the following command in PowerShell: “docker pull microsoft/nanoserver”.. This command will download a container image based on Nano Server Windows Server 2016 from the Docker Hub.

Now execute the “docker run -it microsoft/nanoserver powershell” command from PowerShell. Afterwards, in a separate PowerShell, enter “docker ps” to see your running containers and get information about them. To leave the container, simply enter the “exit” command until you return to the local session.

Be the first to comment

Leave a Reply

Your email address will not be published.


*