Skip to content

Commit

Permalink
Add project-name to docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
spilin committed Jan 29, 2025
1 parent bf52956 commit b5e2e37
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type Container struct {
// It uses docker-compose to handle the container lifecycle
func (d *Docker) RecreateContainers(containers []Container) error {
pathToDockerCompose := viper.GetString("pathToDockerCompose")
projectName := viper.GetString("projectName")
uniqueContainers := d.UniqueContainers(containers)

// Define the sequence of commands to execute
Expand All @@ -46,7 +47,11 @@ func (d *Docker) RecreateContainers(containers []Container) error {
errMessage: "Error stopping and removing containers",
},
{
args: append([]string{"compose", "-f", pathToDockerCompose, "up", "-d", "--force-recreate", "--no-deps"}, serviceNames...),
args: append([]string{"compose",
"-f", pathToDockerCompose,
"--project-name", projectName,
"up", "-d", "--force-recreate", "--remove-orphans", "--no-deps"},
serviceNames...),
desc: "Recreating containers",
errMessage: "Error recreating containers",
},
Expand Down

0 comments on commit b5e2e37

Please sign in to comment.