Skip to main content

Set Up Instructions for Docker on Windows

Original Author: Brian F, November 23, 2021

Preamble and Prerequisites for installing Docker on Windows

The following instructions assume you have Administrator Level Access to your Windows computer for installing software.

Check before install

  • Virtualization must be enabled in BIOS:

    Enable in BIOS: Hardware Assisted Virtualization and Data Execution = enabled.
  • There are detailed instructions to enable Virtualization on Lenovo systems.

  • Windows Linux Kernel "WSL2" needs to be installed and activated.

    • There are two methods for installing WSL2, outlined below; we recommend using the Automated PowerShell method.

Automated install of WSL2 and activation from PowerShell prompt

  1. Open PowerShell as Administrator
    • Right click the PowerShell icon, choose "run as Administrator".
  2. enter the command: > wsl --install
    • This command will enable the required optional components, download the latest Linux kernel and set WSL2 as your default.

Manual instructions for installing WSL2 Kernel

WSL2 download from the Microsoft site:

Beginning at Step #4, Install WSL2Kernel from here:

caution

Only Follow the Steps 1-5 for WSL2 setup,download and activation.

WSL install should be complete , do not proceed to step #6 of the WSL setup.

Begin: Start Docker Desktop download and setup

  1. Go to the website and download "Docker Desktop For Windows"

  2. Run the Docker Installer as Administrator.

    • Right click the DockerDesktopInstaller.exe and select: 'run as administrator'.
  3. Follow the installation process until the process is done and reboot.

    note

    reboot is necessary to add your < username > to the Docker group.

  4. Run Docker Updates.

    • After initial reboot, log back in and open Docker Desktop.
    • From Docker Desktop, click the Settings Gear, choose Software Update and restart when complete.
    • Updating Docker to latest version is important.

Docker Desktop is now installed, next steps involve setting up your first container.

Download the Yale REDCap Docker image

note

Yale REDCap-Docker-Compose is referred to as "RDC".

  1. Create a run location for your Docker (Windows) containers
    mkdir c:\Users\ < netid > \Containers
note

From here this location is noted as: ~\Containers.

  1. Obtain a copy of the "Yale-REDCap-Docker-Main" i.e. RDC (Currently on REDCap@Yale network drive)

  2. Copy the RDC folder to ~\Containers\yale-redcap-docker-main

Run the Yale REDCap Docker Image

  1. open a PowerShell prompt - then run the following commands.
  2. > cd ~\Containers\yale-redcap-docker-main\rdc
  3. ...rdc> docker-compose up -d (the '-d' option instructs command to run in background)
  4. Let the initial Docker build process complete.

Finishing the Docker Build from a web browser

  1. With the Docker Image running in background, open a web browser and navigate to: http://localhost:8081

    • or instead of ':8081' use whatever port has been specified in your .env file.
  2. You should see a screen titled: "REDCap-Docker-Compose Installer".

    1. There will be two options for installing REDCap:
      1. "Use your Community Consortium login"
        • This will use your credentials to download an installer from the REDCap Consortium site.
      2. "Use a local copy of the full zip installer".
        • This may be the quickest and easiest option.
note

We have provided the REDCap_install.zip on the REDCap@Yale network drive.

  1. When install is complete, use a web browser to navigate to http://localhost:8081 to log into REDCap.
note

If option for "Prepopulate with table-based users..." was used, the user passwords will be "password".

  1. If the install did not complete as intended, or you want to rebuild with different options, then run the Docker Commands below to stop the container and remove all the Docker images.

Additional Docker commands, notes and examples

  • List all running Docker containers. Usually the first command used to verify successful Docker startup.

    ...\rdc> docker ps
  • Take down the docker machine, without removing any of the VMs. Use this option to preserve the current state.

    ...\rdc> docker-compose down
  • Take down the docker machine and remove the VMs

    ...\rdc> docker-compose down -v
  • Stop and remove all running images:

    ...\rdc\> docker rmi -f $(docker images -a -q)
  • Use docker exec to get a running shell on the Docker VM:

    ...\rdc\> docker exec -it redcap_db /bin/bash
  • MySQL Override Scripts: (root, redcap default passwords set here)

    ...\rdc\redcap-overrides\mysql\scripts\20_mysql8_permission_update.sql

Optional and only as required

You may have additional (Windows system) ports, and libraries locked out by other local services, This can create a problem for Docker services. Here is how to remove some common offenders, using PowerShell:

  • Remove all Hyper-V libraries, from machine using PowerShell Administrator Window

    Get-WindowsOptionalFeature -online | ? featurename -like *Hyper* | Disable-WindowsOptionalFeature -Online -Remove
  • Remove all Microsoft IIS from machine using PowerShell Administrator Window

    Get-WindowsOptionalFeature -online | ? featurename -like "IIS" | Disable-WindowsOptionalFeature -Online -Remove
  • Docker Images vs Containers:


Additional Notes:

The Yale REDCap Docker image has the following VMs:

  • redcap_cron: scheduled tasks for REDCap
  • redcap_mailhog: an SMTP Mailer trap interface
  • redcap_web: Apache Web
  • redcap_db: Database MySQL
  • PHPMyAdmin: for editing the database.
  • .env file is an override for declared settings found in Dockerfile and other build files