File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change 33"""
44
55import docker
6+ from traitlets import Dict
67from iso8601 import parse_date
78
89from .engine import Container , ContainerEngine , ContainerEngineException , Image
@@ -53,12 +54,27 @@ class DockerEngine(ContainerEngine):
5354
5455 string_output = False
5556
57+ extra_init_args = Dict (
58+ {},
59+ help = """
60+ Extra kwargs to pass to docker client when initializing it.
61+
62+ Dictionary that allows users to specify extra parameters to pass
63+ to APIClient, parameters listed in https://docker-py.readthedocs.io/en/stable/api.html#docker.api.client.APIClient.
64+
65+ Parameters here are merged with whatever is picked up from the
66+ environment.
67+ """ ,
68+ config = True ,
69+ )
70+
5671 def __init__ (self , * , parent ):
5772 super ().__init__ (parent = parent )
5873 try :
59- self ._apiclient = docker .APIClient (
60- version = "auto" , ** docker .utils .kwargs_from_env ()
61- )
74+ kwargs = docker .utils .kwargs_from_env ()
75+ kwargs .update (self .extra_init_args )
76+ kwargs .setdefault ("version" , "auto" )
77+ self ._apiclient = docker .APIClient (** kwargs )
6278 except docker .errors .DockerException as e :
6379 raise ContainerEngineException ("Check if docker is running on the host." , e )
6480
You can’t perform that action at this time.
0 commit comments