@@ -189,9 +189,18 @@ async function createDockerProxy(proxyPort: number, httpsConfig: { certPath: str
189189 const filterString = reqUrl . searchParams . get ( 'filters' ) ?? '{}' ;
190190
191191 try {
192- const filters = JSON . parse ( filterString ) as { [ key : string ] : string [ ] } ;
193- const projectFilter = ( filters . label ?? [ ] )
194- . filter ( l => l . startsWith ( "com.docker.compose.project=" ) ) [ 0 ] ;
192+ const filters = JSON . parse ( filterString ) as {
193+ // Docs say only string[] is allowed, but Docker CLI uses bool maps in "docker compose"
194+ [ key : string ] : string [ ] | { [ key : string ] : boolean }
195+ } ;
196+ const labelFilters = (
197+ _ . isArray ( filters . label )
198+ ? filters . label
199+ : Object . keys ( filters . label )
200+ . filter ( key => ! ! ( filters . label as _ . Dictionary < boolean > ) [ key ] )
201+ ) ;
202+ const projectFilter = labelFilters . filter ( l => l . startsWith ( "com.docker.compose.project=" ) ) [ 0 ] ;
203+
195204 if ( projectFilter ) {
196205 const project = projectFilter . slice ( projectFilter . indexOf ( '=' ) + 1 ) ;
197206
@@ -206,7 +215,7 @@ async function createDockerProxy(proxyPort: number, httpsConfig: { certPath: str
206215 // containers, and b) future non-proxied requests only find non-intercepted containers.
207216 // By excluding non-intercepted containers, we force DC to recreate, so we can then
208217 // intercept the container creation itself and inject what we need.
209- ...filters . label . filter ( ( label ) => label !== projectFilter ) ,
218+ ...labelFilters . filter ( ( label ) => label !== projectFilter ) ,
210219 `com.docker.compose.project=${ project } _HTK:${ proxyPort } `
211220 ]
212221 } ) ) ;
0 commit comments