Let’s Talk

We would love to hear from you. Want to know more about
our services or have any questions? Say Hi!

Need An Accurate Estimate For Your Sitecore XM Cloud Migration Project? Kickstart Your Journey Here!

Get My Estimate

A step by step guide to install a docker

July 27, 2022
A step by step guide to install a docker
Mitesh Patel
Mitesh Patel
Technical Head
step-by-step-guide-to-install-docker

For installing a docker, first of all these are certain prerequisites and requirements that you must fulfil. They are:

  1. Enable Windows features
  2. Enable-WindowsOptionalFeature -Online -FeatureName containers -All
  3. Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V –All

Alternative option would be to enable the features above from the Turn Windows features on and off!

How to install the docker?
  • Download the docker from
    https://www.docker.com/get-started
  • If you have a windows server, you can ever try installing the docker from PowerShell using a module.
    https://docs.microsoft.com/en-us/virtualization/windowscontainers/quick-start/set-up-environment?tabs=Windows-Server)
  • Please note, if you install the docker like shown above, you need to edit/create the needed configuration file manually (as it does not exist by default). Read more here: (https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-docker/configure-docker-daemon*)
  • Sample Docker config:
    {
    "dns": ["8.8.8.8"],
    "data-root": "d:\\docker-data",
    "debug": false,
    "hosts": [],
    "registry-mirrors": [],
    "insecure-registries": []
    }
  • Make sure that virtualization is enabled in your BIOS (in case of a VM you cannot do this)
  • After the docker has been installed successfully, you have to switch to Windows containers.
  • Open the Docker desktop menu by right clicking on the icon in the taskbar Click on Switch to Windows Containers.
  • Copy Sitecore License to **c:\license folder**, so your license should be available on** c:\license\license.xml** path.
  • Please make sure you are using a valid, up to date license file! If at all you are not sure, reach out to the team.
  • If you have locally installed Solr which listens to the 8984 port, you have to stop that Solr Instance.
  • If your local IIS is listening on port 443, you will need to stop it.
  • This requires an elevated PowerShell or command prompt. iisreset /stop.
  • If you are using a newer Docker than 3.4.0, you should disable V2 compose features by the following command.
    ```
    docker-compose disable-v2
    ```
  • If you used PowerShell to install the Docker Engine (e.g.: on a Windows Server) you need to install Docker Compose by hand:(https://docs.docker.com/compose/install/ and it won't be the Compose CLI).
Required & Optional Docker Configuration

Optional: Changing the Docker data location. (e.g moving the data folder to a different drive)

  • Add "data-root":"d:\\docker-data" node to the Docker Engine settings (obviously change the drive letter to the one you use/have).

Required: If the application within the container cannot access internet (e.g.: calling Jitterbit)

  • Add "dns":["8.8.8.8"] node to the Docker Engine settings
    (this is Google's DNS IP address).
How to spin up the project?
  • If you have IIS running, stop it
  • Open PowerShell (or CMD) in Administrator mode
  • Checkout the project from this repository
  • Create a copy of the **.env-template** file, and name it to **.env** (.env file is on GitIgnore)
  • Call init.ps1 PowerShell script
  • Important!
  • This step will register sitename.localhost and id.sitename.localhost URL in your host file and it will point to 127.0.0.
    ```
  • .\init.ps1
    ```
  • If you get a Warning window, you can accept it and add the certificates:
  • ![Certprompt](documentation/certprompt.png)
  • Type the following command to spin up the site

  • ```
  • docker-compose up -d

  • ```

(If this is the first time when you start the site, you may need to restart CM container to flush SC caches, otherwise SXA site will not be served/found)

  • Stopping containers:
    ```
    docker-compose down --remove-orphans

So, this was a step-by-step guide on how to install a docker!


YOU MAY ALSO LIKE