@@ -189,9 +189,18 @@ async function createDockerProxy(proxyPort: number, httpsConfig: { certPath: str
189
189
const filterString = reqUrl . searchParams . get ( 'filters' ) ?? '{}' ;
190
190
191
191
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
+
195
204
if ( projectFilter ) {
196
205
const project = projectFilter . slice ( projectFilter . indexOf ( '=' ) + 1 ) ;
197
206
@@ -206,7 +215,7 @@ async function createDockerProxy(proxyPort: number, httpsConfig: { certPath: str
206
215
// containers, and b) future non-proxied requests only find non-intercepted containers.
207
216
// By excluding non-intercepted containers, we force DC to recreate, so we can then
208
217
// intercept the container creation itself and inject what we need.
209
- ...filters . label . filter ( ( label ) => label !== projectFilter ) ,
218
+ ...labelFilters . filter ( ( label ) => label !== projectFilter ) ,
210
219
`com.docker.compose.project=${ project } _HTK:${ proxyPort } `
211
220
]
212
221
} ) ) ;
0 commit comments