This is a walkthrough on getting up and running with Orchard Core CMS on Windows Server 2022, using Docker with Windows containers, along with a sample docker-compose.yml file.
Note: this procedure will probably also work on Windows Server 2016 or greater, although I've only tested on Server 2022.
Overview:
- enable the Containers feature in Windows Server Manager
- install Docker
- install Docker Compose
- create files and set permissions
- run docker-compose command
Log into your Windows Server machine as Administrator, and open Windows Server Manager. Then:
- select "Manage" from the top menu bar (or under the Quick Start menu on Dashboard), and select "Add Roles and Features"
- click Next on the "Before You Begin" page
- for Installation type, select "Role-based", and then Next
- select the name of the server where the feature will be installed and click "Next"
- no changes are to be made on the Server Roles page, so just click "Next"
- on the Features page, check the box next to "Containers" and click "Next"
- click "Install"
- when it's done, click close
- restart the machine
After the system has rebooted, run PowerShell as Administrator. From there, run the following:
Install-Module -Name DockerMsftProvider -Repository PSGallery –Force
This command will prompt you to install the Nuget provider in order to install the module. Go for it. Then, run the below command to install the latest Docker version:
Install-Package -Name docker -ProviderName DockerMsftProvider
Select "Yes to all", then:
Restart-Computer
Once it's rebooted, re-open PowerShell as Administrator, and confirm that it's working by running:
Get-WindowsFeature -Name containers
Now check the docker version, and verify it's running with by using these two commands:
docker --version
and also:
Get-Service docker
Run PowerShell as Administrator. Enable TLS 1.2 by running:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Run the following command to download the latest release of Compose (as of this writing, v2.16.0, but change the version as needed):
Start-BitsTransfer -Source "https://github.com/docker/compose/releases/download/v2.16.0/docker-compose-Windows-x86_64.exe" -Destination $Env:ProgramFiles\Docker\docker-compose.exe
Test the installation:
docker-compose version
In either File Exporer or from the command line, create the parent directory for your Orchard Core CMS install, for example, Orchard-Core-CMS
, and cd into it. Into that directory, either clone the files from this repo, or create them manually (there's only 2: the App_Data
dir and the docker-compose.yml
file).
Since we want to persist Orchard data even if the Docker container is stopped or removed, we need to first set some permissions on our parent folder before we do anything else.
Follow these steps to add the "Users" group to our app:
- in File Explorer, right-click the parent dir (in our case,
Orchard-Core-CMS
, or whatever you named it) - click Properties
- click the Security tab
- next to where it says, "To change permissions", click the "Edit" button.
- click the Add button
- where it says "Enter the object names", type "users" in the text box
- click "Check Names" (should auto fill the value for you)
- click OK
- Highlight your newly added Users group
- Under "Permissions for [User/Groupname]" select Full control
- click apply
- click "OK"
- click "OK"
From the command line, cd into the parent directory (Orchard-Core-CMS
, or whatever you named it).
Run:
docker-compose up
This will take a while the first time you run it, but subsequent builds will be very fast. You'll see lots of logs. If all goes well, at the end of this you should be able to navigate to http://localhost:8080
and continue your Orchard Core setup from within the browser.
Check to make sure files are persisted by navigating to the App_Data
directory. You should now see some files that Orchard has created (logs, Sites, tenants.json).
If all is going well, now you can exit the session by typing Ctrl+C. We'll now want to run it again, but this time in the background so our terminal window doesn't need to stay open.
Now, run:
docker-compose up -d
The -d
flag will run it in detached mode. Feel free to close the terminal session. You should again be able to navigate to http://localhost:8080
, and the data from your initial setup should still be there.
To stop the running Orchard container, simply run:
docker-compose down