Categories
Sitecore

Docker: Fixing Sitecore docker-compose error

First thanks to Sitecore Slack Chat #docker channel in helping to find solution to issues that I faced in my very first days of learning and playing with Docker and Sitecore with Docker.

Here I’m trying to document the solution that might help others who face the same issue as me.

To begin with, first I started to learn about Docker and then about Sitecore with Docker. I had watched some videos on YouTube and Pluralsight course on Docker and read GitHub Gists from fellow Sitecore community Devs before starting with anything and then started with installing and playing with Docker shortly and followed this course as per my understanding of everything so far.

Getting Started with Docker with Sitecore

Steps:

  1. Install Docker for Windows
  2. Clone Docker for Sitecore repository
  3. Executed below commands, trying to get the vanilla Sitecore up and running in docker.
> Open powershell window in administrator mode

> CD into directory where you cloned the repository in my case it was 'C:\Projects\docker-images\'

> .\Build.ps1 -SitecoreUsername SITECORE_DEV_EMAIL -SitecorePassword SITECORE_DEV_PASSWORD -SitecoreVersion 9.3.0 -Topology xp -WindowsVersion 1803 -IncludeSpe

# I had edited Build.ps1 to allow '1803' windows version here because it matched with my windows OS version at that point

> .\Set-LicenseEnvironmentVariable.ps1 -Path C:\license\license.xml

> docker image ls

> cd .\windows\tests\9.3.x

> docker-compose -f .\docker-compose.xp.yml up

Got stuck on this Docker error

At this point, I got stuck with error message as below:

Pulling sql (sitecore-xp-sqldev:9.3.0-windowsservercore-ltsc2019)…
 ERROR: The image for the service you're trying to recreate has been removed. If you continue, volume data could be lost. Consider backing up your data before continuing.
 Continue with the new image? [yN]<strong>y</strong>
 Pulling sql (sitecore-xp-sqldev:9.3.0-windowsservercore-ltsc2019)…
 ERROR: pull access denied for sitecore-xp-sqldev, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

First Fix: Windows Update

As I checked in the #docker channel in the Sitecore Slack and learned that I had to update my Windows OS to at-least 1903 version so I spent next day or two waiting for system updates to complete. Please note: The time taken depends on your machine and internet speed.

If you are thinking how to check Windows OS version?

Check this out. Press Windows Key + I and then click on System tile then click on About from left navigation and it should show your system version as below –

Windows OS version.

This is noteworthy – After system update I tried Build.ps1 with new version i.e. 1903 (earlier it was 1803) as below, it started doing more than what was done in last time so that was good sign:

.\Build.ps1 -SitecoreUsername SITECORE_DEV_EMAIL -SitecorePassword SITECORE_DEV_PASSWORD -SitecoreVersion 9.3.0 -Topology xp -WindowsVersion 1903 -IncludeSpe

This time Build.ps1 took around 2-3 hours to complete and once it completed I tried docker-compose -f .\docker-compose.xp.yml up command again and still had the same error at this point.

Final Fix: Update environment file

Another quick chat in slack and I found the final fix. Update .env file under /windows/tests/9.3.x/ folder as below:

Updated Docker .env file.

I had to update WINDOWSSERVERCORE_VERSION from ltsc2019 to 1909 and NANOSERVER_VERSION from 1803 to 1909. I think these values got messed up when I was first trying to get it to work.

Quick note: Here I’m trying to setup Sitecore XP0 (XP standalone) for version 9.3.0 that is why I’m using ‘9.3.x’ folder so this folder can be different for you based what version you are targeting.

Finally, I re-ran the docker-compose -f .\docker-compose.xp.yml up command again and there it started composing without the error.

That is all to resolve the said error with docker-compose.

Finally, I was able to see my vanilla Sitecore instance from browser at http://localhost:44001/ locally. Please note that the port number here depends on the configuration as I kept the default values that came from https://github.com/Sitecore/docker-images it is port 44001 here.

Also, It is advised to use docker-compose with flag -d which will cut down the verbose logging seen in console and from what I’m hearing it’s called Detached mode.

Start following #docker channel in Sitecore Slack for more fun stuff.

Thanks to Michael West, Aaron Bickle, and Dylan Young for all the help…

Happy Sitecoring!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site supports SyntaxHighlighter via WP SyntaxHighlighter. It can highlight your code.
How to highlight your code: Paste your code in the comment form, select it and then click the language link button below. This will wrap your code in a <pre> tag(or shortcode) and format it when submitted.

This site uses Akismet to reduce spam. Learn how your comment data is processed.