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
- Open PowerShell as Administrator
- Right click the PowerShell icon, choose "run as Administrator".
- 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
Go to the website and download "Docker Desktop For Windows"
Run the Docker Installer as Administrator.
- Right click the
DockerDesktopInstaller.exe
and select: 'run as administrator'.
- Right click the
Follow the installation process until the process is done and reboot.
note
reboot is necessary to add your
< username >
to the Docker group.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".
- Create a run location for your Docker (Windows) containers
mkdir c:\Users\ < netid > \Containers
note
From here this location is noted as: ~\Containers
.
Obtain a copy of the "Yale-REDCap-Docker-Main" i.e. RDC (Currently on REDCap@Yale network drive)
Copy the RDC folder to
~\Containers\yale-redcap-docker-main
Run the Yale REDCap Docker Image
- open a PowerShell prompt - then run the following commands.
> cd ~\Containers\yale-redcap-docker-main\rdc
...rdc> docker-compose up -d
(the '-d' option instructs command to run in background)- Let the initial Docker build process complete.
Finishing the Docker Build from a web browser
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.
You should see a screen titled: "REDCap-Docker-Compose Installer".
- There will be two options for installing REDCap:
- "Use your Community Consortium login"
- This will use your credentials to download an installer from the REDCap Consortium site.
- "Use a local copy of the full zip installer".
- This may be the quickest and easiest option.
- "Use your Community Consortium login"
- There will be two options for installing REDCap:
note
We have provided the REDCap_install.zip on the REDCap@Yale network drive.
- 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".
- 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:
- When using Docker, the concepts of Containers vs Images is an important one
- Read more here: https://stackoverflow.com/questions/23735149/what-is-the-differencebetween-a-docker-image-and-a-container
Additional Notes:
The Yale REDCap Docker image has the following VMs:
redcap_cron
: scheduled tasks for REDCapredcap_mailhog
: an SMTP Mailer trap interfaceredcap_web
: Apache Webredcap_db
: Database MySQLPHPMyAdmin
: for editing the database..env
file is an override for declared settings found in Dockerfile and other build files