Skip to content

Commit 94b7ffd

Browse files
committed
adding specification of label schema for #93
1 parent ef94e35 commit 94b7ffd

2 files changed

Lines changed: 57 additions & 3 deletions

File tree

pages/docs/user-docs/docs-environment-metadata.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ folder: docs
99

1010
Singularity containers have two level of metadata - environment variables, and labels from the user and bootstrap process.
1111

12+
1213
### Environment
1314

1415
If you are importing a Docker container, the environment will be imported as well. If you want to define custom environment variables in your bootstrap recipe file `Singularity` you can do that like this
@@ -58,7 +59,26 @@ export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
5859
```
5960

6061
### Labels
61-
Your container stores metadata about it's build, along with Docker labels. You can see the data as follows:
62+
Your container stores metadata about it's build, along with Docker labels, and your custom labels that you define in a bootstrap `%labels` section. For containers that are generated with Singularity version 2.4 and later, labels are represented using the <a href="http://label-schema.org/rc1/">rc1 Label Schema</a>. For example:
63+
64+
```
65+
singularity inspect dino.img
66+
{
67+
"org.label-schema.usage.singularity.deffile.bootstrap": "docker",
68+
"MAINTAINER": "Vanessasaurus",
69+
"org.label-schema.usage.singularity.deffile": "Singularity.help",
70+
"org.label-schema.usage": "/.singularity.d/runscript.help",
71+
"org.label-schema.schema-version": "1.0",
72+
"org.label-schema.usage.singularity.deffile.from": "ubuntu:latest",
73+
"org.label-schema.build-date": "2017-07-28T22:59:17-04:00",
74+
"org.label-schema.usage.singularity.runscript.help": "/.singularity.d/runscript.help",
75+
"org.label-schema.usage.singularity.version": "2.3.1-add/label-schema.g00f040f",
76+
"org.label-schema.build-size": "715MB"
77+
}
78+
```
79+
80+
You will notice that the one label doesn't belong to the label schema, `MAINTAINER`. This was a user provided label during bootstrap. For versions earlier than 2.4, containers did not use the label schema:
81+
6282

6383
```bash
6484
singularity exec centos7.img cat /.singularity.d/labels.json

pages/docs/user-docs/docs-inspect.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ toc: false
66
folder: docs
77
---
88

9-
How can you sniff an image? We have provided the inspect command for you to easily see the runscript, test script, environment, and metadata labels.
9+
How can you sniff an image? We have provided the inspect command for you to easily see the runscript, test script, environment, help, and metadata labels.
1010

1111
{% include toc.html %}
1212

@@ -27,6 +27,7 @@ INSPECT OPTIONS:
2727
-t/--test Show the test script for this image
2828
-e/--environment Show the environment settings for this container
2929
-j/--json Print structured json instead of sections
30+
-hf/--helpfile Inspect the runscript helpfile, if exists
3031

3132
EXAMPLES:
3233

@@ -91,11 +92,12 @@ $ singularity inspect ubuntu.img
9192
and as outlined in the usage, you can specify to see any combination of `--labels`, `--environment`, `--runscript`, `--test`, and `--deffile`. The quick command to see everything, in json format, would be:
9293
9394
```
94-
$ singularity inspect -l -r -d -t -e -j ubuntu.img
95+
$ singularity inspect -l -r -d -t -e -j -hf ubuntu.img
9596
{
9697
"data": {
9798
"attributes": {
9899
"test": null,
100+
"help": "This is how you run the image!\n",
99101
"environment": "# Custom environment shell code should follow\n\n",
100102
"labels": {
101103
"SINGULARITY_DEFFILE_BOOTSTRAP": "docker",
@@ -159,6 +161,38 @@ $ singularity inspect -r ubuntu.img
159161
exec /bin/bash "$@"
160162
```
161163
164+
### Help
165+
The commands `--helpfile` or `-hf` will show you the runscript helpfile, if it exists. With `--json` you can also see it as such:
166+
167+
```
168+
singularity inspect -hf -j dino.img
169+
{
170+
"data": {
171+
"attributes": {
172+
"help": "\n\n\nHi there! This is my image help section.\n\nUsage:\n\nboobeep doo doo\n\n --arg/a arrrrg I'm a pirate!\n --boo/b eeeeeuzzz where is the honey?\n\n\n"
173+
},
174+
"type": "container"
175+
}
176+
}
177+
```
178+
179+
or in a human friendly, readable print to the screen, don't use `-j` or `--json`:
180+
181+
```
182+
$ singularity inspect -hf dino.img
183+
184+
185+
Hi there! This is my image help section.
186+
187+
Usage:
188+
189+
boobeep doo doo
190+
191+
--arg/a arrrrg I'm a pirate!
192+
--boo/b eeeeeuzzz where is the honey?
193+
194+
```
195+
162196
163197
### Environment
164198
The commands `--environment` and `-e` will show you the container's environment, again specified by the `%environment` section of a bootstrap file, and other `ENV` labels that might have come from a Docker import. You can again choose to see `--json`:

0 commit comments

Comments
 (0)