@@ -1114,19 +1114,87 @@ Add
11141114---
11151115
11161116It might be the case that you have a container locally, and you want to
1117- make it available as a module (without pulling it from a registry). Although
1118- this is discouraged because it means you will need to manually maintain
1119- versions, shpc does support the "add" command to do this. You can simply provide
1120- the container path and the unique resource identifier:
1117+ make it available as a module (without pulling it from a registry). You might also
1118+ have a container on Docker Hub that you want to contribute to the registry!
1119+ shpc does support the "add" command to perform both of these functions.
1120+ The steps for adding a container are:
1121+
1122+ 1. Running ``shpc add `` to create a container.yaml in the registry namespace
1123+ 2. Customizing the container.yaml to your liking
1124+ 3. Running ``shpc install `` to formally install your new container.
1125+
1126+ In the case of a docker image that is public (that you can share) you are encouraged
1127+ to contribute your recipe directly to shpc for others to use, and once in the repository
1128+ tags will also get updated automatically.
1129+
1130+ Add a Local Container
1131+ ^^^^^^^^^^^^^^^^^^^^^
1132+
1133+ As an example, let's start with the container ``salad_latest.sif ``. We have it
1134+ on our local machine and cannot pull it from a registry. First, let's run ``shpc add ``
1135+ and tell shpc that we want it under the ``dinosaur/salad `` namespace.
1136+
1137+ .. code-block :: console
1138+
1139+ $ shpc add salad_latest.sif dinosaur/salad:latest
1140+ Registry entry dinosaur/salad:latest was added! Before shpc install, edit:
1141+ /home/vanessa/Desktop/Code/shpc/registry/dinosaur/salad/container.yaml
1142+
1143+ At this point, you should open up the container.yaml generated and edit to your liking.
1144+ This usually means updating the description, maintainer, aliases, and possibly providing a url
1145+ to find more information or support. Also notice we've provided the tag to be latest. If you update this registry
1146+ entry in the future with a new version, you'll want to provide a new tag. If you provide
1147+ an existing tag, you'll be asked to confirm before continuing. When you are happy,
1148+ it's time to install it, just as you would a regular container!
11211149
11221150.. code-block :: console
11231151
1124- $ shpc add salad_latest.sif vanessa/salad:latest
1152+ $ shpc install dinosaur/salad:latest
1153+
1154+
1155+ And this will generate the expected module and container in your respective directory bases:
1156+
1157+
1158+ .. code-block :: console
1159+
1160+ $ tree modules/dinosaur/salad/
1161+ modules/dinosaur/salad/
1162+ └── latest
1163+ ├── 99-shpc.sh
1164+ └── module.lua
1165+
1166+ 1 directory, 2 files
1167+
1168+ $ tree containers/dinosaur/salad/
1169+ containers/dinosaur/salad/
1170+ └── latest
1171+ └── sha256:77c7326e74d0e8b46d4e50d99e848fc950ed047babd60203e17449f5df8f39d4.sif
1172+
1173+ 1 directory, 1 file
1174+
1175+
1176+ Add a Registry Container
1177+ ^^^^^^^^^^^^^^^^^^^^^^^^
1178+
1179+ Let's say we want to generate a container.yaml recipe for a container on Docker Hub.
1180+ Let's say we want to add `vanessa/pokemon <https://hub.docker.com/r/vanessa/pokemon >`_.
1181+ First, let's run ``shpc add ``. Note that we provide the ``docker:// `` unique resource
1182+ identifier to tell shpc it's from a Docker (OCI) registry.
1183+
1184+ .. code-block :: console
1185+
1186+ $ shpc add docker://vanessa/pokemon
1187+ Registry entry vanessa/pokemon:latest was added! Before shpc install, edit:
1188+ /home/vanessa/Desktop/Code/shpc/registry/vanessa/pokemon/container.yaml
1189+
1190+
1191+ And that's it! The container module will use the same namespace, ``vanessa/pokemon `` as the Docker image,
1192+ and we do this purposefully as a design decision. Note that ``add `` previously would add the container directly to the module
1193+ directory, and as of version 0.0.49 it's been updated to generate the container.yaml first.
1194+ Also note that ``add `` is only supported for Singularity, as Docker and Podman containers are
1195+ typically provided via registries. If you are looking for support for add for another
1196+ container technology, please `open a new issue <https://github.com/singularityhub/singularity-hpc/issues >`_.
11251197
1126- If the unique resource identifier corresponds with a registry entry, you
1127- will not be allowed to create it, as this would create a namespace conflict.
1128- Since we don't have a configuration file to define custom aliases, the container
1129- will just be exposed as it's command to run it.
11301198
11311199Get
11321200---
0 commit comments