Skip to content

Commit bc1f2af

Browse files
GodloveDvsoch
authored andcommitted
Bootstrap from image (#104)
* added documentation on bootstrapping from local image * adding vsoch's edits
1 parent bc235b2 commit bc1f2af

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

pages/docs/user-docs/docs-bootstrap-image.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ The main content of the bootstrap file is broken into sections.
125125
#### %setup
126126
Setup is where you might perform actions on the host before we move into the container. For versions earlier than 2.3, or if you need files during `%post`, you should copy files from your host to `$SINGULARITY_ROOTFS` to move them into the container. For 2.3 and cases when you don't need the files until after `%post`, we recommend you use `%files`. We can see the difference between `%setup` and `%post` in the following asciicast:
127127

128-
{% include asciicast.html source='docs-bootstrap-setup-vs-post.json' title='How does the container see setup vs post?' author='vsochat@stanford.edu'%}
128+
{% include asciicast.html source='docs-bootstrap-setup-vs-post.json' title='How the container sees setup vs post' author='vsochat@stanford.edu'%}
129129

130130
In the above, we see that copying something to `$SINGULARITY_ROOTFS` during `%setup` was successful to move the file into the container, but copying during `%post` was not.
131131

pages/docs/user-docs/docs-bootstrap.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ The process of *bootstrapping* a Singularity container is equivalent to describi
1010

1111
{% include toc.html %}
1212

13-
## The header fields:
13+
## The header:
1414

1515
### Bootstrap:
16-
The `Bootstrap: ` keyword identifies the Singularity module that will be used for building the core components of the operating system. There are several supported modules at the time of this writing:
16+
The `Bootstrap: ` keyword identifies the Singularity module that will be used for building the core components of the operating system. The module that you choose using `Bootstrap: ` defines the other keywords and values are needed/make sense in the header. There are several supported modules at the time of this writing:
1717

18-
##### **yum**
18+
#### **yum**
1919

2020
The YUM bootstrap module uses YUM on the host system to bootstrap the core operating system that exists within the container. This module is applicable for bootstrapping distributions like Red Hat, Centos, and Scientific Linux. When using the `yum` bootstrap module, several other keywords may also be necessary to define:
2121

@@ -25,24 +25,32 @@ The YUM bootstrap module uses YUM on the host system to bootstrap the core opera
2525

2626
Warning, there is a major limitation with using YUM to bootstrap a container and that is the RPM database that exists within the container will be created using the RPM library and Berkeley DB implementation that exists on the host system. If the RPM implementation inside the container is not compatible with the RPM database that was used to create the container, once the container has been created RPM and YUM commands inside the container may fail. This issue can be easily demonstrated by bootstrapping an older RHEL compatible image by a newer one (e.g. bootstrap a Centos 5 or 6 container from a Centos 7 host).
2727

28-
##### **debootstrap**
28+
#### **debootstrap**
2929
The Debian bootstrap module is a tool which is used specifically for bootstrapping distributions which utilize the `.deb` package format and `apt-get` repositories. This module will bootstrap any of the Debian and Ubuntu based distributions. When using the `debootstrap` module, the following keywords must also be defined:
3030

3131
- **MirrorURL**: This is the location where the packages will be downloaded from. When bootstrapping different Debian based distributions of Linux, this will define which varient will be used (e.g. specifying a different URL can be the difference between Debian or Ubuntu).
3232
- **OSVersion**: This keyword must be defined as the alpha-character string associated with the version of the distribution you wish to use. For example, `trusty` or `stable`.
3333
- **Include**: As with the `yum` module, the `Include` keyword will install additional packages into the core operating system and the best practice is to supply only the bare essentials such that the `%inside` scriptlet has what it needs to properly completely the bootstrap.
3434

35-
##### **arch**
35+
#### **arch**
3636
The Arch Linux bootstrap module does not name any additional keywords at this time. By defining the `arch` module, you have essentially given all of the information necessary for that particular bootstrap module to build a core operating system.
3737

38-
##### **docker**
38+
#### **docker**
3939
The Docker bootstrap module will create a core operating system image based on an image hosted on a particular Docker Registry server. By default it will use the primary Docker Library, but that can be overridden. When using the `docker` module, several other keywords may also be defined:
4040

4141
- **From**: This keyword defines the string of the registry name used for this image in the format [name]:[version]. Several examples are: `ubuntu:latest`, `centos:6`, `alpine:latest`, or `debian` (if the version tag is ommitted, `:latest` is automatically used).
4242
- **IncludeCmd**: This keyword tells Singularity to utilize the Docker defined `Cmd` as the `%runscript` (defined below), if the `Cmd` is defined.
4343
- **Registry**: If the registry you wish to download the image from is not from the main Docker Library, you can define it here.
4444
- **Token**: Sometimes the Docker API (depending on version?) requires an authorization token which is generated on the fly. Toggle this with a `yes` or `no` here.
4545

46+
#### **localimage**
47+
This module allows you to bootstrap a container from an existing Singularity image on your host system. You can use an existing container image as your "base" and then customize it with a new `%post` `%environment`, `%runscript`, etc.
48+
49+
This module allows you to bootstrap a container from an existing Singularity image on your host system. You can use an existing container image as your "base," and then add customization. For example, you may have a different base image for several common operating systems, or for different versions of python, or for several different compilers. Instead of building these from scratch each time, you could start with the appropriate local base image and then customize the new image in `%post`, `%environment`, `%runscript`, etc.
50+
51+
When bootstrapping from a local image, all previous definition files that led to the creation of the current image will be stored in a directory within the container called `/.singularity.d/bootstrap_history`. Singularity will also alert you if environment variables have been changed between the base image and the new image during bootstrap.
52+
53+
- **From**: This keyword defines the path of the base image to bootstrap from. We recommend that you use absolute paths to point to your base image. In particular, substituting `~` for `/home/user` will likely fail or bootstrap from the wrong image because the bootstrap occurs as root.
4654

4755
## Bootstrap sections:
4856
Once the `Bootstrap` module has completed, the sections are identified and utilized if present. The following sections are supported in the bootstrap definition, and integrated during the bootstrap process:

0 commit comments

Comments
 (0)