@@ -20,7 +20,13 @@ export class DockerContainerInterceptor implements Interceptor {
2020 private config : HtkConfig
2121 ) { }
2222
23- private docker = new Docker ( ) ;
23+ private _docker : Docker | undefined ;
24+ private getDocker ( ) {
25+ if ( ! this . _docker ) {
26+ this . _docker = new Docker ( ) ;
27+ }
28+ return this . _docker ;
29+ }
2430
2531 async isActivable ( ) : Promise < boolean > {
2632 return isDockerAvailable ( ) ;
@@ -32,7 +38,7 @@ export class DockerContainerInterceptor implements Interceptor {
3238 // We cache the containers query whilst it's active, because this gets hit a lot,
3339 // usually directly in parallel by getMetadata and isActive, and this ensures
3440 // that concurrent calls all just run one lookup and use the same result.
35- this . _containersPromise = this . docker . listContainers ( )
41+ this . _containersPromise = this . getDocker ( ) . listContainers ( )
3642 . finally ( ( ) => { this . _containersPromise = undefined ; } ) ;
3743 }
3844 return this . _containersPromise ;
@@ -70,7 +76,7 @@ export class DockerContainerInterceptor implements Interceptor {
7076 } as const ;
7177
7278 ensureDockerServicesRunning ( proxyPort ) ;
73- await restartAndInjectContainer ( this . docker , options . containerId , interceptionSettings ) ;
79+ await restartAndInjectContainer ( this . getDocker ( ) , options . containerId , interceptionSettings ) ;
7480 }
7581
7682 async isActive ( proxyPort : number ) : Promise < boolean > {
0 commit comments