feat: docker_create_network y docker_remove_network en infra
Funciones para crear y eliminar redes Docker. DockerCreateNetwork usa bridge como driver por defecto. Necesarias para pipelines que orquestan múltiples contenedores en red compartida. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package infra
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// DockerRemoveNetwork elimina una red Docker por nombre o ID.
|
||||
func DockerRemoveNetwork(nameOrID string) error {
|
||||
out, err := exec.Command("docker", "network", "rm", nameOrID).CombinedOutput()
|
||||
if err != nil {
|
||||
return fmt.Errorf("docker network rm %s: %s", nameOrID, strings.TrimSpace(string(out)))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user