Debugging issues sitecore docker containers

With the increasing adoption of Docker containers, there is a need to understand how dockers are used in the Sitecore ecosystem
I am made an attempt to collate issues that one might potentially encounter while bringing up your Sitecore docker containers on your local development environment
- Issues with traefik
When you run docker-compose up -d you might encounter quite a few issues as below
- Cannot start Traefik
- Traefik container {id} is unhealthy
- Cannot start service Xconnect : The process cannot access the file as it is being used by another process
Solution :
These errors indicate that the port that the service (traefik) is trying to access is being used by another process , most likely IIS
Before running your docker command ensure that IIS is stopped — iisreset /STOP
2. file ‘\.\pipe\docker_engine’ cannot be mapped. Only directories can be mapped on this platform
or
pull access denied for docker-examples-xp0-xconnect, repository does not exist or may require ‘docker login’: denied: requested access to the resource is denied
Solution :
This error occurs when using Docker Compose V2. Turn off the option in Docker Desktop settings or use the CLI command docker-compose disable-v2
or Disable it on docker settings

3. Restore Nuget Packages — Unable to load the service index for source https://api.nuget.org/v3/index.json

Solution :
The container doesn’t have connectivity to the internet so can’t get bring down the packages. We can see this clearly by building this very very simple docker file
FROM mcr.microsoft.com/dotnet/core/sdk
RUN ping google.com
The DNS server is wrong in the container. To fix, hardcode the DNS into Docker i.e. put this JSON
“dns”: [“10.1.2.3”, “8.8.8.8”]
into the Docker daemon settings

4. Init.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.
Solution : Script execution policy to be set to remotesigned or disabled
set-executionpolicy remotesigned
5. Solr Issues
for solr-init Container “563b5132c4ab” is unhealthy
ERROR: for solr cannot start service solr
Solution :
Check if there are multiple instances of solr running and stop instance running on the default port or change port number in docker-compose.yml

Happy Sitecoring :)