Skip to content

Commit

Permalink
locate docker executable
Browse files Browse the repository at this point in the history
  • Loading branch information
spilin committed Feb 5, 2025
1 parent 139870a commit ed9a02a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ statsContainerName: "stats"
table: "silos"
chainId: "replace-with-actual-chain-id"
pathToEnvFile: "./config/sidecar.env"
projectName: "blockscout"
7 changes: 6 additions & 1 deletion internal/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ func (d *Docker) RecreateContainers(containers []Container) error {
projectName := viper.GetString("projectName")
uniqueContainers := d.UniqueContainers(containers)

dockerPath, err := exec.LookPath("docker")
if err != nil {
return fmt.Errorf("docker executable not found: %w", err)
}

// Define the sequence of commands to execute
containerNames := d.GetContainerNames(uniqueContainers)
serviceNames := d.GetServiceNames(uniqueContainers)
Expand All @@ -60,7 +65,7 @@ func (d *Docker) RecreateContainers(containers []Container) error {

// Execute each command in sequence
for _, cmd := range commands {
execCmd := exec.Command("docker", cmd.args...)
execCmd := exec.Command(dockerPath, cmd.args...)
execCmd.Stdout = os.Stdout
execCmd.Stderr = os.Stderr

Expand Down

0 comments on commit ed9a02a

Please sign in to comment.