Setup course

Install Vary with Docker

Get Vary running locally with Docker, verify the compiler, and run a first file from your working directory.

For each lesson, copy the code into the filename shown in the terminal, run the command next to the lesson, then paste the output of the program into the answer box and validate it. Your score is saved in this browser, so you can leave and come back later on the same device.

Section 1

Docker setup

Use the published container image so you do not need to install a local JDK first.

terminal
docker --version

Lesson 1 / terminal

Confirm Docker works

Check that Docker is installed before pulling the Vary image.

Vary ships as a container image, so the compiler and runtime live inside Docker rather than on your host. If this command does not print a Docker version, install Docker before continuing.

Run docker --version
Expected output
Accepted pattern ^Docker version [0-9]+\.[0-9]+\.[0-9]+, build [0-9a-f]+$
terminal
alias vary='docker run --rm \ -u "$(id -u):$(id -g)" \ -v "$(pwd):/workspace" \ -w /workspace \ ghcr.io/ccollicutt/vary:latest' vary --version

Lesson 2 / terminal

Create the Vary Docker alias

Create a local vary command that runs the compiler container in your current directory.

The alias mounts your current directory into /workspace inside the container, so files you edit locally are visible to the compiler and generated files stay owned by your user. Add it to your shell profile, reload, and verify vary is on $PATH.

Run vary --version
Expected output
Accepted pattern ^Vary v[0-9]+-alpha\.[0-9]+ .+$
main.vary
import system let here: Str = system.cwd().to_str() print("cwd=" + here)

Lesson 3 / main.vary

Run a Vary file through Docker

Print the working directory and verify it is the container's /workspace mount.

The Docker alias mounts your current directory at /workspace inside the container, so a program that prints system.cwd() will report /workspace if and only if it ran through Docker. Anything else means the alias was bypassed and vary ran on the host.

Run vary run main.vary
Expected output
cwd=/workspace

Course score

0/3 lessons complete

Validate each lesson output to finish this course.

Next course

Vary Introduction Ten short programs that show what Vary is for: typed code, pure boundaries, contracts, and tests strong enough to survive mutation. Continue