Local Development - Developing with a local copy of PrairieLearn

Use these instructions to launch PrairieLearn on your local machine using Docker.

Prerequisites

These are one-time setup steps.

  1. Install Docker Desktop
  2. Sign in to Docker
    docker login
    
  3. Clone your course repo

    Your course repo is, for example:

    git clone git@github.com:PrairieLearn/pl-ucsb-cmpsc110.git
    cd pl-ucsb-cmpsc110
    

Run PrairieLearn (no external grader)

First, cd into the directory where you cloned the PrairieLearn course repo, and update the main branch.

cd pl-ucsb-cmpsc110
git pull origin main

Then start docker:

docker run -it --rm -p 3000:3000 -v `pwd`:/course prairielearn/prairielearn

Access PrairieLearn in Browser

Once you see this message:

info: PrairieLearn server ready, press Control-C to quit
info: Go to http://localhost:3000
  • Open your browser and go to http://localhost:3000
  • Click the Load from Disk button upper right:

    image

  • After the course loads, click the Back to Previous Page button upper left:

    image

  • Then you should see your course, and be able to try questions.

Common Error: Docker Daemon Not Running

If you see this error:

Cannot connect to the Docker daemon at unix:///Users/.../.docker/run/docker.sock

Solution:

  • Open Docker Desktop from Applications or Launchpad
  • Wait for it to fully start (🐳 whale icon turns green)
  • Then retry the docker run command

Table of contents