示例#1
0
func geardIdler(cmd *cobra.Command, args []string) {
	systemd.Require()

	dockerClient, err := docker.GetConnection(dockerSocket)
	if err != nil {
		idler.Fail(1, "Unable to connect to docker on URI %v", dockerSocket)
	}
	idler.NewIdler(dockerClient, hostIp).Run()
}
示例#2
0
func main() {
	idlerCmd := &cobra.Command{
		Use:   "geard-idler",
		Short: "Geard-idler is a tool for monitoring containers and idling/un-idling them based on traffic",
		Run:   geardIdler,
	}
	idlerCmd.PersistentFlags().StringVarP(&dockerSocket, "docker-socket", "S", "unix:///var/run/docker.sock", "Set the docker socket to use")
	idlerCmd.PersistentFlags().StringVarP(&hostIp, "host-ip", "H", guessHostIp(), "Set the docker socket to use")

	if err := idlerCmd.Execute(); err != nil {
		idler.Fail(1, err.Error())
	}
}