DEV Community

Kenneth McAndrew
Kenneth McAndrew

Posted on

Get Docker Running Without the Desktop

As many of you may know, and I'm sure you find out if you go to download it, Docker Desktop is no longer free. While I don't think they have a mechanism to check these things, technically if you're on a bigger team or your company earns a good chunk in revenue, you're supposed to pay for it now. And a Docker account does get you some benefits.

But...it's one of those "carpet pulled from under your feet" things, isn't it? Kind of like when Oracle said you had to start paying for JDK, and all us Sitecore developers were using it for Solr, and were like "uh, what?!?" Of course, now everyone knows how to use OpenJDK, and Sitecore even baked that into its setup scripts. So, similar principle.

Fortunately, it's only a few things needed to get Docker running "in the wild" so to speak. Fire up your trusty Powershell prompt and start here:

choco install docker-engine docker-compose docker-cli
choco install Containers Microsoft-Hyper-V --source windowsfeatures

This gets the basics of Docker installed for you, including the engine and command structure. Also, for Sitecore folks, it gets Hyper-V installed and ready for Windows containers.

The next bit you may not have to do, but I definitely did. When I tried to fire up my docker-compose process after removing Docker Desktop and using the commands above, I got errors in my solution build trying to hit the Nuget site. The fix is to update the C:\ProgramData\docker\config\daemon.json file (which you could do in the settings in Docker Desktop). Our version that worked is as follows (your mileage may vary on this one):

{
  "registry-mirrors": [],
  "insecure-registries": [],
  "debug": false,
  "experimental": false,
  "dns": [
    "10.1.2.3",
    "8.8.8.8"
  ],
  "features": {
    "buildkit": false
  },
  "builder": {
    "gc": {
      "enabled": true,
      "defaultKeepStorage": "20GB"
    }
  }
}

Enter fullscreen mode Exit fullscreen mode

Finally, you need to start the Docker Engine service; it was installed above but not started. Again, Powershell, and run this command:

start-service -displayname "Docker Engine"

The other nice thing Docker Desktop provided was monitoring of your containers and images, as well as quick access to logs and a terminal prompt. Well, there's another tool that can do that for you...Visual Studio. I believe the "classic" Visual Studio has it, but I use VS Code for this one. If it isn't already installed, check your extensions for the Docker and Docker Explorer ones at the vary least. Once you do this, you'll have a sidebar item for Docker that will give you access to everything you need. The one catch is you may need to either run VS Code as an administrator, or set up your Docker Engine service to run as an administrator. I chose the first option myself, but do what works for you (subject to your company policy of course!).

Top comments (1)

Collapse
 
anthonyfernandes80 profile image
Anthony Fernandes

I had a sitecore nextjs docker setup working (from here-> doc.sitecore.com/xp/en/developers/...).
After uninstalling docker, I followed the above steps, but I am get the following error when I run the up.ps1 script file. Any thoughts on why this could be happening please?

[+] Running 12/13

  • Network sug_containers_default Created 0.3s
  • Container sug_containers-solr-1 Healthy 36.3s
  • Container sug_containers-mssql-1 Healthy 34.4s
  • Container sug_containers-mssql-init-1 Healthy 52.1s
  • Container sug_containers-solr-init-1 Started 47.1s
  • Container sug_containers-xconnect-1 Healthy 109.2s
  • Container sug_containers-id-1 Healthy 84.8s
    • Container sug_containers-cm-1 Error 83.2s
  • Container sug_containers-cortexprocessingworker-1 Start... 122.6s
  • Container sug_containers-xdbautomationworker-1 Started 122.5s
  • Container sug_containers-xdbsearchworker-1 Started 122.3s
  • Container sug_containers-traefik-1 Created 0.2s
  • Container sug_containers-rendering-1 Started 75.8s dependency failed to start: container sug_containers-cm-1 exited (1) Waiting for CM to become available... Invoke-RestMethod : Unable to connect to the remote server At C:\Projects\nextjs-sc\next-js\up.ps1:50 char:19
    • ... $status = Invoke-RestMethod "localhost:8079/api/http/routers ... + ~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc eption
    • FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand (edited)