Files
nigiri/cli/cmd/stop.go
altafan 495f6f1115 refactor:
* remove init command
* add use of docker volumes
* pull images from docker hub
* create start stop delete commands
* add resources folder
2019-04-05 14:27:09 +02:00

29 lines
544 B
Go

package cmd
import (
"os"
"os/exec"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
var StopCmd = &cobra.Command{
Use: "stop",
Short: "Stop containers",
Run: stop,
PreRun: startStopChecks,
}
func stop(cmd *cobra.Command, args []string) {
composePath := getComposePath()
bashCmd := exec.Command("docker-compose", "-f", composePath, "stop")
bashCmd.Stdout = os.Stdout
bashCmd.Stderr = os.Stderr
if err := bashCmd.Run(); err != nil {
log.WithError(err).Fatal("Error while stopping Docker containers:")
}
}