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:
- How to RDP to AWS Windows Instance
- How to RDP to Google GCP Windows Instance
- How to RDP to Azure Windows Virtual Machine
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:
The Docker Compose version should be displayed.
Install Docker Engine
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 Install-PackageProvider -Name NuGet -RequiredVersion 126.96.36.199 -Force Install-Module DockerMsftProvider -Force Install-Package Docker -ProviderName DockerMsftProvider -Force Start-Service docker
Reboot your server and your ready to start using Docker Compose.
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 2016
version: "3" services: webserver: image: hello-world:nanoserver-sac2016 networks: - default networks: default: external: name: nat
On Versions running Docker Compose on Windows Server 2019
version: "3" services: webserver: image: hello-world:nanoserver 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:
And you should see the following message:
PS C:\test> docker-compose up Pulling webserver (hello-world:nanoserver-sac2016)... nanoserver-sac2016: Pulling from library/hello-world bce2fbc256ea: Pull complete 6f2071dcd729: Pull complete 909cdbafc9e1: Pull complete a43e426cc5c9: Pull complete Digest: sha256:878fd913010d26613319ec7cc83b400cb92113c314da324681d9fecfb5082edc Status: Downloaded newer image for hello-world:nanoserver-sac2016 Creating test_webserver_1 ... done Attaching to test_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-sac2016) 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 powershell webserver_1 | webserver_1 | Share images, automate workflows, and more with a free Docker ID: webserver_1 | https://hub.docker.com/ webserver_1 | webserver_1 | For more examples and ideas, visit: webserver_1 | https://docs.docker.com/get-started/ webserver_1 | test_webserver_1 exited with code 0
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.