Instruction MOUNT
The MOUNT instructions only affects running a container, not building a
container.
See the section on mount types.
By using MOUNT, targets can specify certain resources (files, directories,
layers, etc) that should be made available when running the container.
Raptor mounts are identified by a name, which is used when running the
container, to declare what to mount.
When running a raptor container, a mount input is specified with the -M <name> <source> command line option.
The syntax -M <input> <source> can be a bit unwieldy.
Since certain mount names are very common, they have a shorter syntax available:
| Name | Long form | Short form |
|---|---|---|
| Input | -M input <foo> | -I <foo> |
| Output | -M output <foo> | -O <foo> |
| Cache | -M cache <foo> | -C <foo> |
For example, suppose we have a simple container (disk-usage.rapt) that just
calculates the disk space used by a mount:
FROM docker://debian:trixie
# Declare the mount "input", and place it at /input
MOUNT input /input
# Calculate the disk space used in /input
CMD "du -sh /input"
If we try to run this, we will get an error message:
$ sudo raptor run disk-usage
[*] Completed [675DE2C3A4D8CD82] index.docker.io-library-debian-trixie
[*] Completed [A24E97B01374CFEF] disk-usage
[E] Raptor failed: Required mount [input] not specified
As we can see, the container builds correctly, but fails because the input
mount is not specified.
To fix this, we specify the input mount:
sudo raptor run disk-usage -I /tmp
[*] Completed [675DE2C3A4D8CD82] index.docker.io-library-debian-trixie
[*] Completed [4BDD0649E00CA728] disk-usage
128M /input
We could have specified -I /tmp as -M input /tmp, but the short form usually
makes the command easier to follow.
Mount type
The example have just looked will probably feel familiar to Docker users, since it is very similar to docker volumes, which are also bind mounts from the host to the container namespace.
However, Raptor mounts are more advanced than that.
For example, in order to build a Debian liveboot iso, we need to provide the
Debian live-boot scripts with a set of squashfs files, generated
from the individual layers of one or more raptor targets.
Docker does not easily provide access to container layers, as it is seen as more of an implementation detail.
In contrast, Raptor considers layers a first-class object, and makes them
available using the MOUNT instruction.
To learn more about different mount types, please see the mount types section.