Skip to content

Commit 89848ac

Browse files
committed
add initial docs on using the workshop containers
fixes #15
1 parent 9c75c04 commit 89848ac

File tree

3 files changed

+269
-0
lines changed

3 files changed

+269
-0
lines changed

book/_toc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ parts:
1212
- file: how-to-guides/artifacts-as-metadata
1313
- file: how-to-guides/view-visualizations
1414
- file: how-to-guides/pipeline-resumption
15+
- file: how-to-guides/use-the-workshop-container
1516
- caption: Explanations
1617
chapters:
1718
- file: explanations/metadata

book/back-matter/glossary.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ DRY
3737
For more information on DRY and software engineering in general, see {cite:t}`pragprog20`.
3838
The {cite:t}`pragprog20` content on DRY is available in a [free example chapter here](https://media.pragprog.com/titles/tpp20/dry.pdf).
3939
40+
epoch
41+
An identifier referencing a release cycle of QIIME 2.
42+
Epochs identifiers represent dates (e.g., `2024.10` references the release cycle initiated in October of 2024).
43+
4044
Interface
4145
The layer of QIIME 2 that users (either humans or other computer software) interact with.
4246
{term}`q2cli` and the {term}`Python 3 API` are the two interfaces covered in *Using QIIME 2*.
Lines changed: 264 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,264 @@
1+
(workshop-container)=
2+
# How to use the QIIME 2 workshop container
3+
4+
````{margin}
5+
```{admonition} Video
6+
:class: tip
7+
The first ~15 minutes of [this video](https://www.youtube.com/watch?v=-NrzA8BcQxQ) illustrate interacting with our workshop container from a recent QIIME 2 workshop.
8+
The specific quay.io URLs referenced in the video should work, but referring to the URLs referenced below will ensure that you're using the most recent workshop containers.
9+
```
10+
````
11+
12+
```{warning}
13+
This document covers use of the QIIME 2 workshops containers, which were released for the first time with QIIME 2 2024.10.
14+
Because this is relatively new functionality (as of October 2024) be sure to test your container before relying on it for a workshop.
15+
Reach out on the [QIIME 2 Forum](https://forum.qiime2.org) if you run into questions or issues.
16+
```
17+
18+
Using a QIIME 2 workshop container will enable you (or your students) to use QIIME 2 on the command line or through Jupyter Lab in a containerized environment that should be consistent across different host operating systems (i.e., whether you're running on macOS, Linux, or Windows).
19+
20+
We recommend using either [Podman](https://podman.io) or [Docker](https://docker.com).
21+
Before you jump in with QIIME 2, follow the "Get Started" (i.e., install) instructions for one or the other on the project's website, and confirm that it's working according to the Podman's or Docker's instructions.
22+
(We don't link to their instructions here so that we don't send you to an outdated link.)
23+
24+
```{admonition} Podman versus Docker
25+
:class: dropdown, question
26+
We don't take much of a stance on whether Podman or Docker is a better tool for using QIIME 2 - teaching with either is still pretty new to us.
27+
28+
Podman seems to have some interesting benefits though, including ease of transition to paid cloud environments (via [Kubernetes](https://www.digitalocean.com/products/kubernetes)) if you need more computational resources than you have access to.
29+
Podman also doesn't require that you have root/admin access on the computer where you're using it, so may work better if you're using computer hardware that is administered by others (such as a laptop computer owned and maintained by your employer).
30+
31+
You can find a perspective on the differences between the two from the developers of Podman [here](https://www.redhat.com/en/topics/containers/what-is-podman#podman-vs-docker).
32+
```
33+
34+
(pull-image)=
35+
## Pull the container image
36+
37+
After installing Docker or Podman, we next need to pull (i.e., download) the image that contains our QIIME 2 environment.
38+
Copy/paste the relevant commands.
39+
40+
`````{tab-set}
41+
````{tab-item} Docker instructions
42+
43+
First, open Docker Desktop.
44+
45+
Then, in a command terminal, run:
46+
47+
```shell
48+
docker \
49+
image \
50+
pull quay.io/qiime2/<distribution>-workshop:<epoch>
51+
```
52+
````
53+
54+
````{tab-item} Podman instructions
55+
56+
The first time you start podman, you'll need to run the following command:
57+
58+
```shell
59+
podman machine init
60+
```
61+
62+
Then, each time you restart your computer, you'll need to run:
63+
64+
```shell
65+
podman machine start
66+
```
67+
68+
Then, run:
69+
70+
```shell
71+
podman \
72+
image \
73+
pull quay.io/qiime2/<distribution>-workshop:<epoch>
74+
```
75+
````
76+
`````
77+
78+
The above commands will require modification to replace `<distribution>` with the QIIME 2 {term}`distribution` that you'd like to install, and to replace `<epoch>` with the QIIME 2 {term}`epoch` that you'd like to install.
79+
For example, if you'd like to install the metagenome distribution from the 2024.10 epoch, your quay.io URL would look like:
80+
81+
```
82+
quay.io/qiime2/metagenome-workshop:2024.10
83+
```
84+
85+
You can browse our container collection on quay.io at https://quay.io/organization/qiime2.
86+
87+
```{tip}
88+
If you're teaching a QIIME 2 workshop and want to provide specific instructions to your students on how to download a container without requiring them to adapt commands (e.g., replace `<distribution>` with `metagenome`), you can feel free to download and modify the contents of this file.
89+
You can download the Markdown source (`.md` file) for this page above (click the ⬇ button toward the top of the page).
90+
```
91+
92+
(create-volume)=
93+
## Create a data storage volume
94+
95+
Next, we create a volume that will be used to store any data we generate during our analysis.
96+
Data that you create in your container will persist and be available the next time you start the container.
97+
98+
`````{tab-set}
99+
````{tab-item} Docker
100+
```shell
101+
docker volume create qiime2-workshop
102+
```
103+
````
104+
````{tab-item} Podman
105+
```shell
106+
podman volume create qiime2-workshop
107+
```
108+
````
109+
`````
110+
111+
(start-container)=
112+
## Start the container
113+
114+
Next, we'll start the container.
115+
116+
`````{tab-set}
117+
118+
````{tab-item} Docker
119+
```shell
120+
docker container run \
121+
-itd \
122+
--rm \
123+
-v qiime2-workshop:/home/qiime2 \
124+
--name qiime2-workshop \
125+
-p 8889:8888 \
126+
quay.io/qiime2/workshops:<distribution>-workshop:<epoch>
127+
```
128+
````
129+
130+
````{tab-item} Docker on Apple M-series
131+
```shell
132+
docker container run \
133+
-itd \
134+
--rm \
135+
-v qiime2-workshop:/home/qiime2 \
136+
--name qiime2-workshop \
137+
-p 8889:8888 \
138+
--platform "linux/amd64" \
139+
quay.io/qiime2/workshops:<distribution>-workshop:<epoch>
140+
```
141+
````
142+
143+
````{tab-item} Podman
144+
```shell
145+
podman container run \
146+
-itd \
147+
--rm \
148+
-v qiime2-workshop:/home/qiime2 \
149+
--name qiime2-workshop \
150+
-p 8889:8888 \
151+
quay.io/qiime2/workshops:<distribution>-workshop:<epoch>
152+
```
153+
````
154+
155+
````{tab-item} Podman on Apple M-series
156+
```shell
157+
podman container run \
158+
-itd \
159+
--rm \
160+
-v qiime2-workshop:/home/qiime2 \
161+
--name qiime2-workshop \
162+
-p 8889:8888 \
163+
--platform "linux/amd64" \
164+
quay.io/qiime2/workshops:<distribution>-workshop:<epoch>
165+
```
166+
````
167+
`````
168+
169+
Again, you'll need to update `<distribution>` and `<epoch>` as described above.
170+
171+
## Interact with Jupyter Lab and QIIME 2
172+
173+
Once the container is running, you can interact with it by opening the following link: http://localhost:8889
174+
This will open a Jupyter Lab window in your web browser.
175+
176+
### Using QIIME 2 through the command line
177+
178+
In the Jupyter Lab window, click the *Terminal* button toward the bottom right.
179+
(Look for a block box with a `$` symbol in it.)
180+
181+
You'll then have command line access to QIIME 2.
182+
183+
In the terminal environment, run the following command:
184+
185+
```shell
186+
qiime info
187+
```
188+
189+
This provides information on your QIIME 2 environment, including the versions of the QIIME 2 framework, Python, and the installed plugins.
190+
191+
To get a start getting a feel for what you can do with your QIIME 2 deployment, run:
192+
193+
```shell
194+
qiime --help
195+
```
196+
197+
This provides a list of the available QIIME 2 plugins.
198+
To learn more about what you can do with one of them (for example, the `feature-table` plugin), call:
199+
200+
```shell
201+
qiime feature-table --help
202+
```
203+
204+
This will display a list of actions (i.e., commands) that are available in that plugin.
205+
To learn how to use one, for example `filter-samples`, call:
206+
207+
```shell
208+
qiime feature-table filter-samples --help
209+
```
210+
211+
That will provide help text and a list of examples that illustrate how to use the command to achieve different goals.
212+
213+
You can return to this document when you need to start, stop, or update your container.
214+
215+
## Stopping the container
216+
217+
When you're no longer using the container, you can stop it as follows:
218+
219+
`````{tab-set}
220+
````{tab-item} Docker
221+
```shell
222+
docker container stop qiime2-workshop
223+
```
224+
````
225+
226+
````{tab-item} Podman
227+
```shell
228+
podman container stop qiime2-workshop
229+
```
230+
````
231+
`````
232+
233+
If using Docker, once you're done using your container and don't have any other containers running, it's a good idea to quit Docker so it's not using resources unnecessarily.
234+
235+
(build-the-image)=
236+
## Building the image locally (optional; experts only ♦♦)
237+
238+
**Expert users** may ultimately be interesting in modifying the image used here.
239+
This can be done with `docker` as follows.
240+
[Pulling the image](pull-image) will be quicker and easier.
241+
242+
First, download the Dockerfile for the workshop container.
243+
```shell
244+
wget https://raw.githubusercontent.com/qiime2/distributions/refs/heads/dev/Dockerfile.workshop
245+
```
246+
247+
Then, edit the file to specify the epoch (e.g., 2024.10) and distribution (e.g., `amplicon`) that you want to build your container for.
248+
249+
Next, make sure that the Docker daemon is running (e.g. by launching Docker Desktop).
250+
251+
Finally, build the image.
252+
253+
`````{tab-set}
254+
````{tab-item} Standard Instructions
255+
```shell
256+
docker image build -t my-image-name .
257+
```
258+
````
259+
````{tab-item} M-series Mac Instructions
260+
```shell
261+
docker image build -t my-image-name --platform "linux/amd64" .
262+
```
263+
````
264+
`````

0 commit comments

Comments
 (0)