# Docker: Fixing Sitecore docker-compose error


First thanks to [Sitecore Slack Chat](https://sitecore.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](https://www.youtube.com/watch?v=SRsCgyPeCTg) on YouTube and [Pluralsight course on Docker](https://app.pluralsight.com/library/courses/play-by-play-docker-web-developers-john-papa-dan-wahlin) 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](https://www.docker.com/products/docker-desktop)
2. Clone [Docker for Sitecore](https://github.com/Sitecore/docker-images) repository
3. Executed below commands, trying to get the vanilla Sitecore up and running in docker.

```powershell
> 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:

```powershell
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.](images/image.png)

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:

```powershell
.\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.](images/image-2.png)

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](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](https://sitecore.chat) for more fun stuff.

Thanks to [Michael West](https://twitter.com/MichaelWest101), [Aaron Bickle](https://www.linkedin.com/in/aaron-bickle-a67ab012/), and [Dylan Young](https://www.youtube.com/watch?v=SRsCgyPeCTg) for all the help...

Happy Sitecoring!
