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.
- Install Docker Desktop
- Download from: https://www.docker.com/products/docker-desktop
- After installation, start the Docker app and ensure the whale 🐳 icon is running in your menu bar.
- Sign in to Docker
docker login -
Clone your course repo
Your course repo is, for example:
- https://github.com/PrairieLearn/pl-ucsb-cmpsc5a/
- https://github.com/PrairieLearn/pl-ucsb-cmpsc8/
- https://github.com/PrairieLearn/pl-ucsb-cmpsc110/
- https://github.com/PrairieLearn/pl-ucsb-cmpsc156/
- etc.
git clone git@github.com:PrairieLearn/pl-ucsb-cmpsc110.git cd pl-ucsb-cmpsc110
Run PrairieLearn (no external grader)
- Note that many courses do use an external grader, including CMPSC 5A.
- For courses with an external grade, follow these instrucitons instead of this step.
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 Diskbutton upper right: -
After the course loads, click the
Back to Previous Pagebutton upper left: - 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 runcommand