Skip to content

Commit

Permalink
Merge pull request #426 from oriser/fix_base_compose_v2_replace
Browse files Browse the repository at this point in the history
Fix compose v2 wait strategy
  • Loading branch information
mdelapenya committed Apr 19, 2022
2 parents 7504bdf + c53f9f9 commit 976da32
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,19 @@ func (dc *LocalDockerCompose) getDockerComposeEnvironment() map[string]string {
return environment
}

func (dc *LocalDockerCompose) containerNameFromServiceName(service, separator string) string {
return dc.Identifier + separator + service
}

func (dc *LocalDockerCompose) applyStrategyToRunningContainer() error {
cli, err := client.NewClientWithOpts(client.FromEnv)
if err != nil {
return err
}

for k := range dc.WaitStrategyMap {
containerName := dc.Identifier + "_" + k.service
composeV2ContainerName := strings.ReplaceAll(containerName, "_", "-")
containerName := dc.containerNameFromServiceName(k.service, "_")
composeV2ContainerName := dc.containerNameFromServiceName(k.service, "-")
f := filters.NewArgs(
filters.Arg("name", containerName),
filters.Arg("name", composeV2ContainerName),
Expand Down

0 comments on commit 976da32

Please sign in to comment.