=================== Container Functions =================== .. default-domain:: bash .. file:: container_functions.bsh Common functionality for adding extra just features to container services .. envvar:: JUST_IN_CONTAINER An environment variable that will be set inside of a container so that a script can know it is inside a container started by :file:`just`. It is set to the specific container technology so that scripts can adapt to the specific container technology used. (E.g. ``docker``, ``singularity``, ``podman``, etc...). .. function:: container_environment_override :Arguments: * ``$1`` - The name of a function that takes two arguments, variable name and variable value, and writes to the corresponding configuration file. * ``JUST_PROJECT_PREFIX`` - The Just project prefix value * ``JUST_DISABLE_ENVIRONMENT_SWAP`` - Transparently swap environment variables as they are added to the docker environment * ``EXPORT_DOCKER`` - Also exports the ``${1}_.*_DOCKER`` version of the variable when using the transparent environment variable swap feature (the swap effectively becomes a copy). Sets up a number of environment variables to make containers behave the way we want them to * ``JUST_HOST_WINDOWS`` - Set to ``1`` on Windows, else unset. This is primarily used in the entrypoint to remove a second slash at the beginning of environment variables that have to be placed there due to limitations in MINGW/Cygwin. These double slashes have, on occasion, caused apps to fail, so removing them becomes important. * ``${JUST_PROJECT_PREFIX}_DOCKER`` - variables are swapped .. seealso:: :func:`docker_compose_override generate_docker_compose_override` Uses this for environment variables .. function:: translate_path Translates a path from one filesystem to another, useful for going from host to a container. :Arguments: * ``$1`` - Original path * ``$2, [$4, $6, ...]`` - Host paths * ``$3, [$5, $7, ...]`` - Container paths :Output: **stdout** - The translated path. If none of the path pairs translated the path, the original path returned .. function:: is_in_container Tests to see if you are currently in a container. Currently only supports: - docker - singularity - podman :Return Value: - ``0`` - In a container - ``1`` - Not in a container