feat: add custom Docker image support and enhanced configuration for DockerExecutor #1057
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add Custom Docker Image Support and Enhanced Configuration for
DockerExecutor
Description
This PR enhances the
DockerExecutor
class by adding the ability to specify custom Docker image names, control the image building process, and configure container runtime parameters. Previously, the executor would always build a new image with a hardcoded name ("jupyter-kernel") on initialization and had limited container configuration options.Changes
Added new parameters to
DockerExecutor.__init__
:image_name
: Allows specifying a custom Docker image name (default: "jupyter-kernel")rebuild_image
: Controls whether to rebuild the image even if it exists (default: True)container_run_kwargs
: Enables passing additional keyword arguments to the Docker container run commandImplemented image existence checking logic:
rebuild_image
is False, the executor will check if the specified image already existsAllows users to customize container settings while maintaining core functionality
Usage Example