Summary and Schedule
This lesson introduces virtual machines and containers to a novice audience of librarians, subject specialists, and library staff with interest or work that intersects data management, data science, or research computing. The intent is breadth, rather than depth. Prior experience is not required but we assume some familiarity with basic computing concepts and with reproducible research. Those that need a refresher of the latter may consider reviewing the Reproducible Research Workflows lesson.
Setup Instructions | Download files required for the lesson | |
Duration: 00h 00m | 1. Introduction |
What are virtual machines and containers? How are they used in open science? |
Duration: 00h 32m | 2. Virtual machines using VirtualBox |
How do you import and launch a VM using VirtualBox? How do you accomplish common tasks? How and why do you change settings for a VM? |
Duration: 00h 44m | 3. Basics of Containers with Docker |
What is a Docker image? What is a Docker container? How do you start and stop a container? How do retrieve output from a container to a local machine? |
Duration: 01h 04m | 4. Creating Containers with Docker | How do you create new Docker images? |
Duration: 01h 16m | Finish |
The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.
Data Sets
We will be using a prebuilt virtual machine that already contains most things needed to get started. Download the .ova file to your system but do not do anything else with it at the moment. We will import it as part of the virtual machines episode.
This lesson will use a single virtual machine for both the virtual machine AND container episodes. Instructors will be responsible for creating this virtual machine image and distributing it to students. The image should be based on a lightweight Linux distribution that has a graphical desktop environment and is able to run Docker. The Debian-based DietPi distribution is one recommendation as it is light on resources and is easily configurable.
Virtual machine image creation instructions for the Debian Bookworm-based DietPi.
Follow steps 1-3 of the DietPi VirtualBox installation guide. Ignore the Wifi and Virtualbox extension pack instructions in step 3. https://dietpi.com/docs/install/#__tabbed_1_2. At the end, you should see the DietPi login prompt.
-
Log in as
root
using the given password.- The DietPi configuration wizard will launch. Use Tab or the arrow keys on your keyboard to change the selection, Enter to confirm a selection.
- If your keyboard is captured by VirtualBox, you will not be able to
use your keyboard/mouse on your main operating system. Press the right
CTRL
key (on Windows) to return the keyboard/mouse to your main operating system.
-
In the configuration wizard
- Opt out of the DietPi survey. Upon selecting
Ok
, the VM will reboot. Let it reboot and the wizard will continue - Select the
Generic 105-Key PC
for the keyboard configuration. SelectOk
- Select the
English (US) keyboard layout
(under Other). SelectOk
- Select
No Alt-Gr
andNo compose key
in the next two dialogs. - In the dialog that asks to change the global software password,
select
Cancel
- In the dialog that asks to change the password of the
root
anddietpi
users, selectCancel
- After completing these steps, you should see the software installation wizard
- Opt out of the DietPi survey. Upon selecting
-
In the software installation wizard
- Select Browse Software from the menu. Then from the list that
appears, select (use the arrow keys to navigate, spacebar to select):
23 LXDE ultra lightweight desktop
134 Docker compose
162 Docker
67 Firefox
- Select
Confirm
to return to the main menu - From the main menu, select
Install
, then clickOk
to begin - Wait for the software to install. On success, the system will return you to a command prompt with the root user already logged in.
- Type
dietpi-config
to launch the configuration - Select
Autostart
from the menu - Select
2: Automatic Login
- Then select
root
, and selectOk
to confirm - Exit out of the menus and exit out of the configuration tool. You should see a command prompt at the bottom of the window.
- At the prompt, type
reboot
to reboot the VM. - If successful, the system should reboot and you should see a graphical desktop with a green DietPi wallpaper. You may optionally remove this wallpaper via the Desktop Preferences.
- At this point, the size of the Virtualbox image should be just over 2.5 GB in size.
- Select Browse Software from the menu. Then from the list that
appears, select (use the arrow keys to navigate, spacebar to select):
-
Set up Docker according to the lesson
- TODO
Shut down the VM via the menus inside the graphical desktop or from the terminal
Export the image as a VirtualBox appliance (.ova file)
Hosting
Instructors are responsible for creating the prebuilt virtual machine and hosting it somewhere accessible to students.
The .ova file can be hosted on any online file sharing service with sufficient space like Box, Google Drive, DropBox, etc.
If there are many learners, remain mindful of any bandwidth limits. For example, Google Drive may cut off access to publicly shared files that exceed a certain amount of transferred data within a certain time period. Therefore, you may wish to host the file on two different services or accounts.
Software Setup
VirtualBox
VirtualBox is the software we will be using for this lesson. Your computer must meet these requirements:
- A recent Intel or AMD CPU
- Windows, Linux, or MacOS (see the sections below for additional information).
- Administrative access
- 8 GB of total memory
- 7 GB of free disk space
Most laptops that are newer than 5-6 years should work.
The prebuilt virtual machine image you downloaded previously contains a preconfigured Docker installation which will be used for the containers portion of the lesson.
Although VirtualBox runs under older version of Windows, at least Windows 10 v1803 is needed to minimize the chance for conflicts if there is other virtualization software installed (e.g., Hyper-V).
- On the downloads page under the VirtualBox Platform Packages section, select Windows hosts.
- Install the downloaded package.
During installation, you may get warnings about missing Python core / win32api dependencies. You may safely ignore this warning as it relates to scripting VirtuaBox with Python which we will not be doing.
There are different download packages depending if you have an Intel Mac or an If you have a Mac with an Intel CPU or an Apple Arm CPU (M1, M2, or M3).
- Intel Macs: On the downloads page under the VirtualBox Platform Packages section, select MacOS / Intel hosts
- Apple M1, M2, or M3: On the Test builds page, download the MacOS / ARM64 Dev Preview file. This version of VirtualBox is experimental and may or may not work for you.
Install the downloaded package. Upon first run, you will need to grant the various system permissions it asks you for.
If VirtualBox crashes on startup, even after granting permissions (may happen for the Test Builds), you may not be able to follow the virtual machines portion of the lesson. You may wish to install Docker directly on your machine if you would still like to follow the containers portion of the lesson.
We recommend installing VirtualBox from your distribution’s package manager. If the version that comes with your distribution is different than the version used in this lesson, the screenshots might differ. If you wish to install the latest version, follow the instructions for your distribution.