Categories
Docker

Docker: Deploying linux containers on Windows

Docker is a great way to containerize your applications. By using Docker, we can replicate production environment locally among many things. We often use Linux containers in this regard. The reason it can be run on either Linux/Mac machines easily.

But what if we need to setup this on a Windows machine. This post will guide you to write equivalent scripts for Windows as well.

Suppose we use the following scripts when working on Linux/Mac machines:

Linux/MacOS scripts

Suppose, following are startup & shutdown scripts for your docker containers. Suppose they are named start-container. & stop-container.:

Shutdown Script (stop-container)

Startup Script (start-container)


Running on Windows?

The scripts mentioned above will not work on Windows. This happens due to some of the following reasons:

  • Command line scripts dont use the same architecture.
  • The commands need to be re-written for a separate platform.

Windows scripts (Solution)

Following are the startup & shutdown scripts for running your docker containers on Windows. Suppose they are named start-container.bat & stop-container.bat:

Shutdown Script (stop-container.bat)

Startup Script (start-container.bat)