@@ -6,6 +6,7 @@ import { Container } from "./container";
66import { ContainerState } from "./container-state" ;
77import { DockerClient } from "./docker-client" ;
88import { DockerodeClientFactory } from "./docker-client-factory" ;
9+ import { resolveDockerComposeContainerName } from "./docker-compose-container-name-resolver" ;
910import { StartedGenericContainer } from "./generic-container" ;
1011import log from "./logger" ;
1112import { HostPortCheck , InternalPortCheck } from "./port-check" ;
@@ -46,7 +47,7 @@ export class DockerComposeEnvironment {
4647 const startedGenericContainers = ( await Promise . all (
4748 startedContainers . map ( async startedContainer => {
4849 const container = await this . dockerClient . getContainer ( startedContainer . Id ) ;
49- const containerName = this . getContainerName ( startedContainer ) ;
50+ const containerName = resolveDockerComposeContainerName ( startedContainer . Names [ 0 ] ) ;
5051
5152 ( await container . logs ( ) )
5253 . on ( "data" , data => log . trace ( `${ containerName } : ${ data } ` ) )
@@ -99,15 +100,6 @@ export class DockerComposeEnvironment {
99100 return boundPorts ;
100101 }
101102
102- private getContainerName ( container : Dockerode . ContainerInfo ) : string {
103- const containerName = container . Names [ 0 ] ;
104- const matches = containerName . match ( / ^ .* d o c k e r - c o m p o s e _ ( .* $ ) / ) ;
105- if ( ! matches ) {
106- throw new Error ( `Unable to compute container name for: "${ containerName } "` ) ;
107- }
108- return matches [ 1 ] ;
109- }
110-
111103 private async waitForContainer (
112104 container : Container ,
113105 containerName : string ,
0 commit comments