Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cmd = &cobra.Command{ Use: "run-postgres", Short: "docker run --name postgres -d -p 5432:5432 -e ... postgres", Aliases: []string{"rpg", "rpostgres"}, Args: cobra.NoArgs, Run: func(c *cobra.Command, args []string) { dockerArgs := []string{ "run", "--name", "postgres", "-d", "-p", "5432:5432", } if FlagVolume != "" { dockerArgs = append(dockerArgs, "-v", FlagVolume+":/var/lib/postgresql/data") } username := FlagUsername if username == "" { username = "postgres" } dockerArgs = append(dockerArgs, "-e", "POSTGRES_USER="+username) password := FlagPassword if password == "" { password = "pg" } dockerArgs = append(dockerArgs, "-e", "POSTGRES_PASSWORD="+password) if FlagDatabase != "" { dockerArgs = append(dockerArgs, "-e", "POSTGRES_DB="+FlagDatabase) } dockerArgs = append(dockerArgs, "postgres") if FlagDryRun { if FlagVolume != "" { fmt.Printf("docker volume create %s\n", FlagVolume) } fmt.Printf("docker %s\n", strings.Join(dockerArgs, " ")) return } if FlagVolume != "" { exec_utils.ExecOut("docker", "volume", "create", FlagVolume) } exec_utils.ExecOut("docker", dockerArgs...) }, }
View Source
var FlagDatabase string
View Source
var FlagDryRun bool
View Source
var FlagPassword string
View Source
var FlagUsername string
View Source
var FlagVolume string
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.