Skip to content

Commit

Permalink
index: Splitting sessions to smaller sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
simo-tuomisto committed Apr 29, 2024
1 parent 84b6565 commit 1eecce7
Show file tree
Hide file tree
Showing 11 changed files with 766 additions and 788 deletions.
322 changes: 0 additions & 322 deletions content/advanced_running_containers.rst

This file was deleted.

68 changes: 68 additions & 0 deletions content/binding_folders.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
Binding folders into your container
===================================

.. objectives::

* Learn how you can bind folders into containers

When you launch a program in a container, the program runs in a contained
environment. The file system in the container might not have the same
folders structure as the machine that runs the container.

So, when you want to work on your data, you need to bring it with you into
this contained world inside the container.

This is done via method called **mount binding**.

Binding means that a folder from the host system is mapped into a folder
inside the container.

.. figure:: img/default_mounts.png

Figure 1: Only some folders are mounted by default

By default, ``$HOME``, ``$CWD`` (current working directory)
``/tmp`` and
`few other paths <https://apptainer.org/docs/user/main/bind_paths_and_mounts.html#system-defined-bind-paths>`__
are bound to the image.

If you want to do additional mappings you need to do it by giving an
extra arguments to the command you're running.

The following would bind folder ``/scratch`` from the host system to
``/scratch`` in the container:

.. code-block:: console
$ apptainer exec --bind /scratch example.sif ls /scratch
.. figure:: img/bind_example.png

Figure 2: Binding a directory inside a container

Setting ``--bind``-argument works for ``apptainer run``- and
``apptainer shell``-commands as well.

You can also bind directories to different places. This is especially
helpful if, for example. the code in container expects that data
should be in ``/data``:

.. code-block:: console
$ apptainer exec --bind /scratch:/data example.sif ls /data
.. warning::

Bind mounts **are the same folders inside and outside** of the image.

Deleting file from the folder that you bound inside the image will
delete the file completely.

.. admonition:: Key points to remember

- By default only some folders are bound inside the container.
- You'll need to manually ``--bind``-folders from outside of
the container if you want to use them inside the container.
- Bound folders are the same folders inside and outside of the
container.

Loading

0 comments on commit 1eecce7

Please sign in to comment.