How to Setup Docker Compose on Windows Server in Azure/AWS/GCP

To run the Docker Compose on Windows Server in Azure, AWS or GCP, the best way is to install the Docker Compose Windows image from the marketplace.  It comes fully configured as per the requirements to run Docker Compose in the cloud. Click on the links below to deploy into your environments

Docker Compose Windows

Table of Contents

Getting Started with Docker Compose Windows

RDP into new server

 

Once you have deployed Docker Compose on Windows server, the first step is to RDP into the new instance once it has fully booted up.  The following links explain how to connect the VM once it has finished being deployed:

 

 

Once logged in, you’re now ready to start setting up your new server as per the following sections.

Using Docker Compose

Test Docker Compose - Check Version

Open up a command prompt or Powershell session and run the following command from to confirm Docker Compose is installed:

				
					docker compose version
				
			

Or try the following if the above doesn’t work, depending on the version of Docker Compose installed:

				
					docker-compose -version
				
			
The Docker Compose version should be displayed.
Docker Compose Version

Install Docker Engine

In order to run Docker Compose we need to install Docker Engine. Run the following PowerShell commands from an Elevated (Right click run as Administrator) Powershell command

				
					[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

Install-PackageProvider -Name NuGet -RequiredVersion 2.8.5.201 -Force

Install-Module DockerMsftProvider -Force

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/Windows-Containers/Main/helpful_tools/Install-DockerCE/install-docker-ce.ps1" -o install-docker-ce.ps1

.\install-docker-ce.ps1 -Force
				
			

The server will then automatically reboot. Log back in and wait for the script to finish loading.

Build Windows Docker Compose Hello World Container

As a test, you can build a Hello World Windows Docker Container, by first creating a folder on your c:\ drive. In my example i will create a folder called c:\project.

 

In this folder create a yaml file called docker-compose.yaml

 

Open up the docker-compose.yaml in notepad and add the following config:

On Versions running Docker Compose on Windows Server 2019 / 2022 / 2025

				
					services:
  webserver:
    image: hello-world:nanoserver
    networks:
     - default

networks:
  default:
    name: nat
    external: true
				
			

On Versions running Docker Compose on Windows Server 2016

				
					version: "3"
services:
  webserver:
    image: hello-world:nanoserver-sac2016
    networks:
     - default
  
networks:
    default:
        external:
            name: nat
				
			

Build and Run Docker Hello World App

Using an elevated (Right-click run as Administrator) Windows Powershell or Windows Command line, make sure the location is where your project folder is c:\project

 

Run the following command to build your test app:

				
					docker compose up
				
			

Or if you’re using Compose V1, try the following command:

				
					docker-compose up
				
			

And you should see the following message:

				
					[+] Running 4/4
 ✔ webserver Pulled                                                                                               43.8s
   ✔ 3c572c5b651b Pull complete                                                                                   40.4s
   ✔ a575af90262d Pull complete                                                                                   41.3s
   ✔ 6308f12cac64 Pull complete                                                                                   41.9s
[+] Running 1/1
 ✔ Container test-webserver-1  Created                                                                             0.8s
Attaching to webserver-1
webserver-1  |
webserver-1  | Hello from Docker!
webserver-1  | This message shows that your installation appears to be working correctly.
webserver-1  |
webserver-1  | To generate this message, Docker took the following steps:
webserver-1  |  1. The Docker client contacted the Docker daemon.
webserver-1  |  2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
webserver-1  |     (windows-amd64, nanoserver-ltsc2025)
webserver-1  |  3. The Docker daemon created a new container from that image which runs the
webserver-1  |     executable that produces the output you are currently reading.
webserver-1  |  4. The Docker daemon streamed that output to the Docker client, which sent it
webserver-1  |     to your terminal.
webserver-1  |
webserver-1  | To try something more ambitious, you can run a Windows Server container with:
webserver-1  |  PS C:\> docker run -it mcr.microsoft.com/windows/servercore:ltsc2025 powershell
webserver-1  |
webserver-1  | Share images, automate workflows, and more with a free Docker ID:
webserver-1  |  https://hub.docker.com/
webserver-1 exited with code 0  
				
			

Documentation

Please refer to Dockers documentation on how to use Docker Compose

 

https://docs.docker.com/compose/gettingstarted/

Support

Any questions regarding the installation of this solution, please leave a comment below or contact us and we will assist as much as we can to help you get Docker up and running in your environment.

 

Disclaimer: Docker is a registred trademark of Docker Inc and is licensed under Apache LicenseV2. No warrantee of any kind, express or implied, is included with this software. Use at your risk, responsibility for damages (if any) to anyone resulting from the use of this software rest entirely with the user. The author is not responsible for any damage that its use could cause.

Avatar for Andrew Fitzgerald
Andrew Fitzgerald

Cloud Solution Architect. Helping customers transform their business to the cloud. 20 years experience working in complex infrastructure environments and a Microsoft Certified Solutions Expert on everything Cloud.

5 1 vote
Article Rating
Subscribe
Notify of
0 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x