Album plugin for creating Docker images from solutions
Plugin for creating Docker images from Album solutions.
The plugin allows you to package an Album solution into a Docker image, which can then be used to run the solution in a containerized environment,
containing all necessary dependencies and configurations.
Behavior of the container will be similar to the album run command, but the solution will be installed in a
Docker image instead of the local environment.
This is particularly useful for ensuring that the solution runs with all its dependencies in a consistent environment.
Installation:
- Install Album
- Activate the album environment:
micromamba activate album
- Install the album docker plugin:
micromamba install album-docker -c conda-forge
Or via pip:
pip install album-docker
Usage:
To create a docker image which contains Album with the passed solution installed run following command:
album docker --solution mySolutionFolder --output /your/output/path
The --solution argument accepts:
-
a solution folder (recommended): the whole folder, i.e. the
solution.pyfile together with all its sibling files and subfolders, is copied into the image. If yoursolution.pyis located in a folder with unrelated files, copy it (and the files it needs) into a new folder first, e.g.mySolutionFolder:mkdir mySolutionFolder cp /path/to/your/solution.py mySolutionFolder/ -
the coordinates
<group>:<name>:<version>of a solution in your Album collection: the folder of the resolved solution, including all its sibling files, is copied into the image. -
a direct path to a solution file: only this file is copied into the image (as
solution.py), sibling files are not included (pass the folder instead). A warning is logged in this case. -
a zip archive of a solution folder: Album extracts it and the extracted folder is copied into the image.
-
a URL or DOI of a solution: Album downloads it, and the downloaded solution (a single file or the extracted folder) is copied into the image.
The outcome is a docker image with the tag <group>_<name>_<version>, where <group>, <name>, and <version> are defined in the solution and the tag is lowercased
(e.g. the solution my-group:My-Solution:0.1.0 gets the tag my-group_my-solution_0.1.0).
The image is available in the local Docker installation and is additionally saved as the archive <group>_<name>_<version>_image.tar (lowercased as well) in the output directory.
If the output directory lies inside the solution folder (e.g. --solution . --output .), the image archives (*_image.tar) of earlier runs in the output directory are not copied into the image.
Input parameter:
--solution(required): The album solution which should be packed into the image (folder, coordinates, solution file, zip archive, URL or DOI, see above).--output(required): The directory where the image archive<group>_<name>_<version>_image.taris saved. It is created if it does not exist.--install-flags: Flags to pass to thealbum installcommand inside the image. Use the=form, because the value starts with--, e.g.--install-flags=--allow-recursive.--install-deps: A command which is added verbatim as aRUNline to the Dockerfile before the solution is installed, e.g.apt-get update && apt-get install -y g++ cmake. The image is based on Ubuntu, so use the apt package names (e.g.g++, not the conda package namegxx).
Running the image:
Load the archive (e.g. on another machine) and run the image by its tag:
docker load -i /your/output/path/<group>_<name>_<version>_image.tar && docker run --rm -v /path/on/host:/data <group>_<name>_<version> --arg value
Everything after the image name is passed to album run of the installed solution,
i.e. the example above runs album run /solution/solution.py --arg value inside the container.
Use -v to mount folders of the host and pass the paths as they are seen inside the container (e.g. /data/...).
Docker options have to come BEFORE the image name, otherwise they are passed to album run.
For example, to give the container access to the GPUs (requires the NVIDIA Container Toolkit on the host) use:
docker run --rm --gpus all -v /path/on/host:/data <group>_<name>_<version> --arg value
Example:
album docker --solution mySolutionFolder --output /your/output/path --install-flags="--allow-recursive" --install-deps="apt-get update && apt-get install -y g++ cmake"
This will create a docker image with the tag <group>_<name>_<version> of the solution and save it as /your/output/path/<group>_<name>_<version>_image.tar.
Inside the image, the solution is installed together with the dependencies g++ and cmake.
Metadata
Release files for album-docker 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| album_docker-0.2.2.tar.gz | 9.6 kB | Without provenance | Details for album_docker-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| album_docker-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for album_docker-0.2.2-py3-none-any.whl |
Total release size: 18.5 kB
Release files / album_docker-0.2.2.tar.gz
| Download URL | album_docker-0.2.2.tar.gz |
|---|---|
| Size | 9.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8a992716464d7b283da1ff2f8a10e0f74daafd0930757aadb85b96d40775b460
|
|
BLAKE2b-256 checksum How to use checksums |
82d9259f0748dfa6bb0b78f9a1ca721c7f430e12d8936091455a09f9b848d5ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.0
|
Release files / album_docker-0.2.2-py3-none-any.whl
| Download URL | album_docker-0.2.2-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ae487d562d1a8dc759520e15ffbadd835444617cba0d99308d8837e9d7086e74
|
|
BLAKE2b-256 checksum How to use checksums |
80f3c7be164061ef753cd8d754e610dbb21dda24fd8c70668775de8cf22c7626
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.0
|
Security for album-docker 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.