Area: Deployment Issues
Sub-Area: Remote Executor Security Hardening & Bundled Ingestion venvs
Applies to: Cloud
Issue
Teams that review the security of their Remote Executor often want to stop it from installing packages from PyPI at run time. They ask when the executor uses the pre-built (bundled) virtual environments in the image, how to add connectors to a hardened image, and what a locked image gives up. This article answers those questions for the datahub-executor image.
You Might Be Asking
- I set the source's CLI Version to the same version as
BUNDLED_CLI_VERSION. Why does the run still install packages? - Can I use a different, dev, or RC CLI version with bundled venvs or a locked image?
- Are
BUNDLED_CLI_VERSIONandBUNDLED_VENV_PLUGINSavailable when I extend the image? - Can I extend a locked image to add connectors?
- How do I build a custom image with extra connectors and then lock it?
- Do Extra Pip Libraries work with bundled venvs or locked images?
- What do I give up with a locked image?
Solution
1. When the executor uses a bundled venv
A run uses a bundled venv only when the source's CLI version is the literal string bundled. The executor does not compare version numbers. Any other value builds a dynamic venv at run time and installs acryl-datahub and the connector into it. That includes an empty value, latest, and the exact version that is bundled in the image.
Set the CLI version in one of these places:
- In the DataHub UI, open the ingestion source's advanced settings and set CLI Version to
bundled. - With
datahub ingest deploy, setcli_versionin the recipe'sdeploymentblock (or pass--cli-version bundled). The CLI removes thedeploymentblock from the recipe and storescli_versionas the source's CLI version.
deployment:
name: my_snowflake_source
cli_version: bundled
source:
type: snowflake
config:
...
If a source has no CLI version, DataHub fills in a default CLI version on the server. That default is a version number, not bundled, so those runs build a dynamic venv. To change the default for your whole instance, contact DataHub Support.
With bundled, the run uses /opt/datahub/venvs/<plugin>-bundled. If that venv is not in the image, the run fails and does not install anything. The run log shows Failed to set up virtual environment: Bundled startup venv not found: /opt/datahub/venvs/<plugin>-bundled.
See Bundled ingestion virtual environments.
2. One CLI version per image build
The builder installs acryl-datahub[<plugins>] pinned to BUNDLED_CLI_VERSION and checks that the installed version matches. A published image bundles every venv at one CLI version. If you extend an image with a different BUNDLED_CLI_VERSION, only the connectors you list are rebuilt at the new version, and the base image's other venvs keep theirs.
To run a different version, a dev wheel, or an RC with bundled, build an image with that version bundled. A non-bundled version gives you a dynamic venv, and that needs uv and a reachable package index.
3. BUNDLED_CLI_VERSION and BUNDLED_VENV_PLUGINS are build settings
Published datahub-executor images set DATAHUB_BUNDLED_VENV_PATH (default /opt/datahub/venvs) as ENV. BUNDLED_CLI_VERSION and BUNDLED_VENV_PLUGINS are used only in the internal build stages that create the bundled venvs. The published image does not set them. A running container does not show them, and an image built FROM it does not inherit them.
When you extend the image, set them in your own Dockerfile from build arguments, as in the example in section 4. If you leave out BUNDLED_CLI_VERSION, the builder uses the acryl-datahub version installed in the image.
4. Adding connectors and locking the image
You can't extend a locked (:tag-locked) image. It has no pip or uv, so the builder can't install anything. Start from an unlocked image instead: :tag (full) or :tag-slim. Both ship the builder at /usr/local/bin/build_bundled_venvs_unified.sh.
Save this as Dockerfile.bundled. The last block is optional and locks the image after the connectors are built:
# syntax=docker/dockerfile:1
ARG EXECUTOR_IMAGE
FROM ${EXECUTOR_IMAGE}
USER root
# Optional: omit to use the acryl-datahub version installed in the base image.
ARG BUNDLED_CLI_VERSION
ENV BUNDLED_CLI_VERSION=${BUNDLED_CLI_VERSION}
ARG BUNDLED_VENV_PLUGINS
ENV BUNDLED_VENV_PLUGINS=${BUNDLED_VENV_PLUGINS}
RUN /usr/local/bin/build_bundled_venvs_unified.sh
# Optional: lock the image (removes pip/uv and blocks package indexes)
RUN sh /usr/local/bin/lock_image.sh
ENV UV_INDEX_URL=http://127.0.0.1:1/simple
ENV UV_DEFAULT_INDEX=http://127.0.0.1:1/simple
ENV PIP_INDEX_URL=http://127.0.0.1:1/simple
ENV PIP_EXTRA_INDEX_URL=""
ENV UV_EXTRA_INDEX_URL=""
USER datahub
Build it:
docker build \
--platform linux/amd64 \
--build-arg EXECUTOR_IMAGE=<registry>/datahub-executor:<tag>-slim \
--build-arg BUNDLED_VENV_PLUGINS=mysql,snowflake \
-f Dockerfile.bundled \
-t <registry>/datahub-executor-custom:<tag> \
.
Each connector you list gets its own bundled venv. A connector that is already in the base image is replaced, and the rest of the image stays the same. Set --platform to the CPU architecture of the nodes that run the executor, because bundled venvs contain architecture-specific wheels. To install from a private package index during the build, add a BuildKit secret mount with your credentials to the builder RUN step.
lock_image.sh must run as root and after the builder step. It removes pip and uv from the executor's own venv and from every bundled venv, and it removes the system uv binary. The ENV lines point the package indexes at an address that can't be reached, so nothing can install even if a package manager comes back. If /usr/local/bin/lock_image.sh is not in your base image, upgrade to the latest executor image.
See Bundling Additional Connectors for single-platform and multi-arch builds.
To check which connectors an image bundles, list its venv directory:
docker run --rm --entrypoint ls <registry>/datahub-executor-custom:<tag> /opt/datahub/venvs
5. Locked images and the CLI version
On a locked image, every run must use bundled. A run with any other CLI version tries to build a dynamic venv and fails, because uv is gone. Set CLI Version to bundled on every source that runs on a locked executor. Don't rely on the server default, because that default is a version number. After you upgrade the image, bundled keeps working and uses the new image's CLI version.
6. Extra Pip Libraries and custom source packages
Extra Pip Libraries (extra_pip_requirements) install only into dynamic venvs. When the CLI version is bundled, the executor uses the pre-built venv as it is and skips the extra packages. On a locked image they can't install at all.
extra_pip_requirements is not a recipe key. Set it in the UI under the source's advanced settings (Extra Pip Libraries), or with extra_pip in the deployment block (or --extra-pip) when you use datahub ingest deploy:
deployment:
name: my_custom_source
extra_pip: '["my-custom-datahub-source==1.0.0"]'
source:
type: my_package.my_module.MyCustomSource
config:
...
The bundled builder installs DataHub connector plugins (acryl-datahub[<plugin>]), so it can't bundle your own source package. To run a custom package, the source needs a non-bundled CLI version on an unlocked image. If the package lives in a private index, set UV_INDEX_URL or UV_EXTRA_INDEX_URL in the Remote Executor's environment.
7. What a locked image gives up
- Any CLI version other than
bundled, including dev and RC builds, unless you rebuild the image with that version. - Extra Pip Libraries.
- Connectors that aren't bundled in the image. To add one, rebuild from an unlocked image.
- Extending the image with the builder.
In return, the image can't install packages at run time.