Container creation - PolyJIT/benchbuild GitHub Wiki

The container binary.

Containers suitable for uchroot usage are created using the container binary.

container [SWITCHES] [SUBCOMMAND [SWITCHES]] args...

Meta-switches
    -h, --help                                    Prints this help message and quits
    --help-all                                    Print help messages of all subcommands and quit
    --version                                     Prints the program's version and quits

Switches
    -i, --input-file CONTAINER:str                Input container path
    -m, --mount USER_MOUNT:ExistingDirectory      Mount the given directory under / inside the uchroot container; may be given multiple times
    -o, --output-file CONTAINER:str               Output container path
    -s, --shell CUSTOM_SHELL:str                  The shell command we invoke inside the container.
    -t, --tmp-dir TMPDIR:ExistingDirectory        Temporary directory
    -v                                            Enable verbose output; may be given multiple times

Subcommands:
    bootstrap                                     Check for the needed files.; see 'container bootstrap --help' for more info
    create                                        Create a new container with a predefined strategy.  We offer a variety of creation policies for a new container. By default a basic 'spawn a bash' policy is used. This just leaves
                                              you inside a bash that is started in the extracted container. After customization you can exit the bash and pack up the result.; see 'container create --help' for more info
    list                                          Prints a list of the known containers.; see 'container list --help' for more info
    run                                           Execute commannds inside a prebuilt container.; see 'container run --help' for more info

Options

PolyJIT containers

Most options are quite self-explanatory, below are 2 special parameters that require additional information.

  • -i: You can provide an archive that contains a container image that is used for container creation.
  • -m: You can add directory mounts inside the container, if you need special tools for container setup available in the container. If available, subdirectories like ./bin and ./lib are added to PATH and LD_LIBRARY_PATH inside the container.

Example

Create a PolyJIT-compatible container can be achieved as follows: container create -S polyjit

Boost

PolyJIT requires boost-thread and boost-system. If you plan to use regular projects in cojunction with the gentoo projects. You need to make sure that the versions match in both the host system and the container, or you end up getting symbol errors. This goes for any other dependency you might add through mounts. The PolyJIT strategy is configurable, such that you can configure the packages that are required inside the container.

Benchbuild

You probably want benchbuild inside the container (after all you're using it to create the container). This is not done automatically by the container creation strategy. It only takes care of PolyJIT being able to run inside the container.

Adding benchbuild inside the container needs to be done manually. After initial container setup is finished, use the container binary again and customize the image as you wish.

Example

In order to add benchbuild to an existing container you can proceed as follows:

  1. Add benchbuild's git checkout as mount point and enter the container via bash. The mount point will be available through a numbered subdirectory of /mnt, e.g., /mnt/0.

    container -m /scratch/pjtest/benchbuild-src -t /tmp/new-gentoo/ -o /tmp/new-gentoo/gentoo-new.tar.bz2 run -- /bin/bash
    
  2. Prepare a virtualenv inside the container at an arbitrary location. Make sure it has python3 inside.

    virtualenv -ppython3 /opt/benchbuild
    source /opt/benchbuild/bin/activate
    pip install /mnt/0/