Skip to content

Your first lab

A lab is a directory next to trylab. The directory name is the lab's name. Use letters, digits, and hyphens. The name default is reserved for the shared disk.

The basics directory is a complete lab. It has two files.

The card

config.yaml describes the lab. title is the name a learner sees in the list of labs, and in the banner at the top of the lab page. That list is the catalog. description is the sentence under the title.

title: Unix command basics
description: Learn the basics of Unix commands ls, cd, mkdir and friends.

basics has nothing else in this file. It adds no software, so it uses the shared disk. The first time you open it, trylab says that disk is missing and asks Build it now?. Press Enter to build it.

The lesson

index.md is the lesson. It is Markdown, text with headings, lists, and blocks of code. The pack's file is a short walk through pwd, ls, mkdir, and cd. Write a command the learner should run in a block tagged shell:

```shell
pwd
```

On the lab page, that block has two buttons. Copy puts the text on the clipboard. Run types the command into the shell and presses Enter. A block tagged bash, sh, zsh, or ksh works the same way. A block with any other tag, or with no tag, is shown as text and can be copied. It does not get a Run button.

A link in the lesson opens in a new browser tab. The lesson is read when the lab opens. It is not stored on the disk.

Open it

trylab starts the lab. Run it with sudo. It needs permission to create the network the lab machine uses.

sudo ./trylab basics

If a program from the install is missing, trylab asks whether to run ./prereqs. Answering yes installs it. The installer asks for your password.

When the machine is up, the program prints a line like this:

open http://localhost:8080/sessions/…/

Open that address. You are logged in as root on the lab machine. The banner says Unix command basics. The lesson is on the page, and the shell is beside it. Ctrl-C in the terminal where trylab is running stops the lab.

Docker is already on the machine

The docker directory is a second lab of the same kind. It has a title, a description, and a lesson. The lesson starts a container. Docker is already on the shared disk, so this lab does not need a disk of its own.

sudo ./trylab docker

The first time that lesson runs docker run, the machine downloads an image. That needs the network.