Docker

How to Run Linux Container on Windows

Docker containers are one of the core components of the Docker network utilized to build, run and distribute software and programs. These containers pack all project dependencies, program code, and other essential settings. However, Linux containers have more control over Docker than Windows containers. Even though in the beginning, most of the Docker features are not available on the Windows system. But the latest or upgraded version of Docker allows us to use Linux containers on the Windows platform.

This blog will demonstrate how to run the Linux container on Windows.

How to Run Linux Container on Windows?

Docker is developed in Linux and is effectively used in Linux distribution. Therefore, developers preferred to use Linux containers for development and deployment. To use or run the Linux container on Windows, utilize the given instructions.

Step 1: Launch Docker and Switch to Linux Containers

First, launch Docker from the Start menu. After that, click on the below highlighted drop-up menu from Taskbar. Here, you will find the Docker icon as shown below:

Right-click on the Docker icon and select the “Switch to Linux containers” option from the appeared context menu:

Hit the “Switch” button to switch to Linux containers on Windows:

Step 2: Log in to Docker Registry

Next, open up the terminal, and log in to the Docker registry using the “docker login” command. For instance, we have utilized the “PowerShell” Windows terminal:

docker login

Step 3: Pull “ubuntu” Image

Pull the “ubuntu” image from the Docker Hub registry:

docker pull ubuntu

Step 4: Run Linux Container

After that, run the ubuntu image to build and start the Linux container. Here “i” is used to execute the container interactively, and the “-t” option allocates the TTY-pseudo terminal to the running container:

docker run -it ubuntu

For the verification, execute the Ubuntu Linux distribution command:

apt-get update

It can be observed that we have successfully executed the Linux update command.

You can also install any package inside the Linux container by utilizing the APT ubuntu repository using the “apt-get install <package>” command:

apt-get install python2-minimal

This is all about how to run a Linux container on Windows.

Conclusion

To run the Linux containers, first, enable the Linux containers in Windows. After that, pull the “ubuntu” image that is purely a part of Linux from the Docker Hub registry. Then, execute the image to build and run the Linux container using the “docker run -t ubuntu” command. This write-up has illustrated how to run a Linux container on Windows.

About the author

Rafia Zafar

I am graduated in computer science. I am a junior technical author here and passionate about Programming and learning new technologies. I have worked in JAVA, HTML 5, CSS3, Bootstrap, and PHP.