BLOG

Img
Jagmeet Kaur Author's Perspective
img
7 Minutes read

A Quick Rundown | Sitecore Docker

What is Docker?

Docker is the open source software which is used to run software development, software testing, software deployment etc. on containers in an isolated, lightweight and virtualized environment. A developer can maintain his/ her software application and all the necessary executables, libraries, binary code and configuration files in the container isolated from all other applications; and it allows the user to bundle all the libraries, applications, software, and any other resource required to run software application into one package and then deploy the whole package to another server where it is intended to run. So, by using this, developers will no longer say – “It was working perfectly fine at my end, need to check why it is not working on your system”

Source: docker.com

Using containers will make software application development/ deployment and management easy, efficient and flexible. Docker is best suited to facilitate the work of those who utilize Agile, DevOps and continuous integration and deployment.

It is crucial to understand the following Docker terminologies:

  • Container – It contains the actual working of the application and all the required libraries or any executable for development, testing or deployment. It is capable of running any small microservice or large application. When there is a need to deploy on production, we can deploy the whole container. We can have more than one container to run a single application, some images on one container and others on another. For example, we may have SQL server on one container and .net on another and then interconnect them together and run a single application. This concept is called Networking.

    Benefits of using containers:

    • They are highly portable and flexible to work on any OS or hardware platform.
    • It has a build-in Version control system like git
    • The problem of incompatibility issues while deploying from one server to another is solved with this.
    • Less number of systems are required when using containers. Hence, the cost is reduced.
    • It helps to increase productivity

  • Images – These are a set of read-only templates/files we download from docker repository that can then be configured to set up an environment for the running container with custom functionalities.
  • Layer – Docker image is made up of a set of layers of files which are bound together according to dependency or hierarchy one on top of another.
  • Source: Sitecore
    In the above picture, we can see three containers: the first container has an environment set up for Sitecore XP with 2 layers – 4.8-windowsservercore-ltsc2019 and on the top of this, we have Sitecore experience platform (XP) layer. Similarly, the other two containers- Sitecore XP-SPE and SPE-SXA have their own set of layers and images as per their requirement. And this way, we can do as many types of customizations as we would like to have.
  • Docker file – Docker file is a text file with an easy to understand syntax to build a docker image to set up the container environment for work. Docker file will help to set up a layer in the image. For example, if you want to set up a Sitecore XP image, then you can see the instructions in the file at Github Sitecore Docker images repository.
  • Volume – It is a very useful feature of docker. We can maintain a folder on your host machine that can be represented inside the container. It may contain log files, html, SQL data or SOLR data so that we don’t need to recreate and to reduce the overhead due to rebuilding every time.

    Some confusions that people have about Docker:

    • Is container a PAAS or IAAS?
    • The container is neither Infrastructure as a service (IAAS) nor Platform as a service (PAAS). The container can be viewed more as a facilitator to run PAAS.

    • Are containers the same as virtual machines?
    • The container cannot be considered as a VM too. Containers and Virtual machines are made on quite different concepts. Virtual machines share the virtualized infrastructure whereas containerization shares the virtualized operating system (see the below image).

  • Source: Sitecore

Why do we need Sitecore Docker?
Following are the scenarios where we face issues which can be resolved by using Docker:

  1. Sometimes while deploying our software application from one platform/ environment to another where it is expected to run, we face incompatibility issues which may be because of different operating systems, different system configurations, software versions, different framework, or several other dependencies. We spend hours resolving such issues, both time and resources get wasted and become difficult when meeting deadlines are our major concerns.
    It even becomes the biggest obstacle when we are utilizing Agile and DevOps continuous integration and delivery.
  2. Sometimes we need to run different applications in the same environment and all applications need different versions of their dependencies. This type of scenario will again lead to incompatibility issues among the different applications.
  3. Issues may arise when developers share the code solution among themselves and it does not work on another developer’s machine whereas it may be working perfectly fine on one developer’s machine.

How to set up the first Sitecore Docker?

  1. You should have windows 10 build version 1809 at least.
  2. Enable Hyper-V services in windows

  3. Or run Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

  4. Enable Intel virtualization
    1. First, check virtualization is enabled or disabled from the performance tab of task manager
    2. If not enabled, enable it depending on whether you are an AMD or Intel user.
    3. You need to reboot the system and enable it through the BIOS setting which controls virtualisation.
  5. Install chocolatey
  6. Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

  7. Install Docker on the desktop by downloading it from
  8. https://www.docker.com/products/docker-desktop
    Or run choco install docker-desktop –y in PowerShell

    Reboot and check the docker version by running docker –version

  9. Install git by downloading it from https://git-scm.com/download/win Or run choco install git in PowerShell

  10. Do not forget to restart the system after installing the above things.
  11. Switch to Window container
    1. Right-click on Docker from window taskbar
    2. And then click on the switch to window containers on the windows system.
  12. Now, let’s create our very first image for Sitecore instance Clone Sitecore images to local from
  13. https://github.com/Sitecore/docker-images Or run git clone https://github.com/Sitecore/docker-images.git

    You will get something like below screenshot in the same location you ran the command

  14. In order to download and install

    Go to the docker folder and run
    .\Build.ps1 -SitecoreUsername "YOUR dev.sitecore.net USERNAME" -SitecorePassword "YOUR dev.sitecore.net PASSWORD"
    This will download the latest version of the site and you prefer to install some previous version
    .\Build.ps1 -SitecoreVersion “9.2.0” -SitecoreUsername "YOUR dev.sitecore.net USERNAME" -SitecorePassword "YOUR dev.sitecore.net PASSWORD"

    There are other options that you can change in the build.ps1 script based on your requirement.

    • If you have the downloaded files, move them to the packages folder. You don’t need to wait for them to get downloaded from dev.sitecore.net
    • Don’t forget to run CleanData.ps1 to wipe off any temporary assets if you want to switch between any different Sitecore architecture.
  15. Run Set-LicenseEnvironmentVariable.ps1 -Path C:\license\license.xml
  16. Go to -\docker-images\windows\tests\9.3.0 location
    1. Run docker-compose -f docker-compose.xp.yml up to spin up sitecore instance
    2. Run docker-compose -f docker-compose.xp.yml down to shutdown containers
  17. Check the list of containers by running docker container ls And the list of images by running docker image ls
  18. Look at the container of docker image sitecore-xp-standalone:9.3.0-windowsservercore-ltsc2019
  19. Login into Sitecore and verify indexes, analytics and other things once.
  20. In order to remove any dangling images, run
    docker system prune or docker image prune depending upon the requirement.
Ebook
Top 10 Sitecore 9 Form Features to Increase Lead Conversions
Jagmeet Kaur
Jagmeet Kaur Senior Associate


Talk to our Experts

Talk to us about how we bring together 1:1 personalisation, deep Martech Expertise, CX & Demand Gen Strategy, Engagement Analytics & Cross-Channel Orchestration to drive award winning experiences that convert

Get in touch for a complimentary consultation or a demo today.

Expert Workshops

Free workshops, expert advice & demos- to help your realize value with Sitecore

Register

Session Presentations

  • Sitecore + SFMC= Marketing Success
  • Transforming The Future Of eCommerce
Meet Us

Giveaways:

Participate in our event survey , meet us at our booth , get free giveaways & a chance to win an iPhone 11

Let’s go
Close Button