Registry / devops / dagster-docker

dagster-docker

JSON →
library0.29.20pypypi✓ verified 24d ago

Dagster-docker is a Dagster integration that enables launching and executing Dagster runs or individual ops/assets within Docker containers. As part of the broader Dagster ecosystem, it follows a separate versioning scheme (currently 0.29.0) but is released in lockstep with the core `dagster` library, which sees frequent updates (typically minor releases weekly or bi-weekly, with major changes less often).

pip install dagster-docker
INSTALL
IMPORT
SIG · DAGSTER-DOCKER
D
dagster-docker
devopspythonv0.29.20
Install
13.6s avg
Import
3504ms
Disk
139MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.29.20 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 3.642s · 137MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 13.6s · import 3.366s · 133MB
139MB installed
● package 139MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DockerRunLauncher
from dagster_docker import DockerRunLauncher
Primarily configured in `dagster.yaml` for a Dagster deployment to launch runs in Docker.
docker_executor
from dagster_docker import docker_executor
A pre-configured executor definition used when defining Dagster jobs programmatically to run ops/assets in Docker.

This quickstart demonstrates how to define a Dagster job that utilizes `dagster-docker`'s `docker_executor`. When this job is launched within a Dagster deployment, the `my_docker_asset` will execute inside a Docker container configured as specified. For this to run successfully, a Docker daemon must be accessible, and the specified Docker image should contain Python and any necessary dependencies for your asset code. Remember to replace `python:3.10-slim-buster` with an image containing your Dagster code for real-world scenarios.

from dagster import Definitions, asset, define_asset_job from dagster_docker import docker_executor import os # Define a simple asset @asset def my_docker_asset(): """An asset whose execution will be managed by a Docker executor.""" message = os.environ.get("GREETING", "Hello from default asset!") print(message) return message # Define a job that uses the docker_executor. # The configuration demonstrates how to specify Docker image and environment variables # for the container in which the asset will run. my_docker_job = define_asset_job( name="my_docker_job", selection=[my_docker_asset], executor_def=docker_executor.configured( { "container_kwargs": { # This image needs to have Python and your Dagster code installed. # For a minimal example, we use a basic Python image. In production, # you'd build an image with your specific Dagster code and dependencies. "image": os.environ.get("DOCKER_IMAGE", "python:3.10-slim-buster"), "environment": { "GREETING": "Hello from inside the Docker container!" }, # Optional: specify a Docker network if your Dagster instance # is also running in Docker and needs to communicate. "network_mode": "bridge" }, # If you want to pass host environment variables directly to the container, # list them here. The values will be taken from the environment where Dagster runs. "env_vars": ["HOST_VAR"] } ), ) # To make these definitions loadable by Dagster (e.g., `dagster dev -f my_file.py`) # you would typically expose them via a Definitions object: # defs = Definitions( # jobs=[my_docker_job], # )
dagster --version
Debug
Known issues
gotchaThe machine running the Dagster daemon/webserver (for `DockerRunLauncher`) or the machine launching jobs (for `docker_executor`) must have access to a running Docker daemon.
fix
Ensure Docker is installed and running, and the Dagster user has permissions to interact with the Docker socket (e.g., `sudo usermod -aG docker $USER` on Linux systems).
affects: All versions
gotchaDocker containers launched by `dagster-docker` need to be able to communicate back to the Dagster API server (e.g., Dagit, Dagster daemon). Incorrect network configuration can lead to runs hanging or failing to report status.
fix
Carefully configure the `network` or `network_mode` parameters in `container_kwargs`, ensuring that the container can reach the Dagster API server's host and port. Often, using a custom Docker network or host networking mode (if applicable) is required for seamless communication.
affects: All versions
breaking`dagster-docker` versions are tightly coupled with the `dagster` core library. Using `dagster-docker` with a significantly mismatched `dagster` core version (e.g., `dagster-docker==0.29.0` with `dagster==1.0.0`) can lead to runtime errors or unexpected behavior due to API changes.
fix
Always install `dagster-docker` alongside the corresponding version of `dagster` you are using. For `dagster-docker==0.29.0`, this means installing `dagster==1.13.0` (or a compatible `1.x.x` version). For example: `pip install dagster==1.13.0 dagster-docker==0.29.0`.
affects: All versions when used with mismatched `dagster` core versions.
Errors
Common errors & fixes
dagster.core.errors.DagsterUserCodeUnreachableError: Could not reach user code server
The Dagster webserver or daemon cannot establish a gRPC connection with the user code process running inside a Docker container, often indicating the user code container failed to start, crashed, or is inaccessible.
fix
Check the `docker logs` of your user code container for detailed errors (e.g., missing dependencies, syntax issues, incorrect entrypoint). Ensure the container is healthy and accessible within the Docker network and that `workspace.yaml` correctly points to the user code's gRPC server.
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
The `dagster-docker`'s `DockerRunLauncher` or `docker_executor` running inside a container cannot connect to the host's Docker daemon, typically due to the `/var/run/docker.sock` volume not being correctly mounted, having incorrect permissions, or becoming stale.
fix
Ensure `/var/run/docker.sock` is correctly bind-mounted into the `dagster_daemon` container (and any other containers requiring Docker access) in your `docker-compose.yml` (e.g., `- /var/run/docker.sock:/var/run/docker.sock`). Verify the user inside the container has permissions to access the socket (e.g., by being in the `docker` group) and restart the `dagster_daemon` container or the host's Docker daemon if the socket is stale.
docker.errors.APIError: 409 Client Error for http+docker://localhost/... Conflict ("Conflict. The container name ... is already in use by container ... You have to remove (or rename) that container to be able to reuse that name.")
The Docker executor attempts to launch a new container for an op or step using a name that is already in use by a stopped or running container, often during retries or concurrent execution of partitioned assets.
fix
This issue can arise with `docker_executor` when containers are not automatically removed. Configure your `DockerRunLauncher` to use `auto_remove=True` in `container_kwargs` (if supported by your `dagster-docker` version) or implement a strategy to ensure unique container names for each run/step, especially during retries or parallel execution. Manual cleanup of stale containers might be required for older setups.
Exception: Docker image name "dagster-user-code" is not correctly formatted
The Docker image name specified in the `dagster.yaml` or `workspace.yaml` for a code location or `DockerRunLauncher` is invalid according to Docker's image naming conventions, often due to typos, missing tags, or extra characters.
fix
Review your `dagster.yaml` or `workspace.yaml` configuration for the `image` key under the `DockerRunLauncher` or code location definition. Ensure the image name adheres to Docker's format (e.g., `my-repo/my-image:tag` or `my-image:latest`), checking for leading/trailing spaces or unresolvable environment variables.
Upgrade
Version history
0.29.20latest on PyPI · released Aug 27, 2026
Audit
Dependencies
dagsterrequiredCore Dagster library, required for all Dagster functionality.
Agent activity
29 hits · last 30 days
node
26
OpenAI (training)
1
Resources
dagster-docker — pip install dagster-docker · libregistry