added ports and fixed docker ID not returning back
This commit is contained in:
@@ -28,7 +28,16 @@ var CliAction = func(ctx *cli.Context) error {
|
||||
|
||||
//Call function to create Docker container
|
||||
if IpAddress != "" {
|
||||
imageRes, err := client.StartContainer(IpAddress)
|
||||
|
||||
var PortsInt int
|
||||
PortsInt = 0
|
||||
|
||||
if Ports != "" {
|
||||
// Convert Get Request value to int
|
||||
fmt.Sscanf(Ports, "%d", &PortsInt)
|
||||
}
|
||||
|
||||
imageRes, err := client.StartContainer(IpAddress,PortsInt)
|
||||
|
||||
if err != nil {
|
||||
fmt.Print(err)
|
||||
|
||||
18
cmd/flags.go
18
cmd/flags.go
@@ -4,8 +4,12 @@ import (
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
var Mode,IpAddress string
|
||||
var ListServers, Ip_table, Abspath bool
|
||||
var (
|
||||
IpAddress string
|
||||
Ports string
|
||||
Mode string
|
||||
)
|
||||
var ListServers bool
|
||||
|
||||
var AppConfigFlags = []cli.Flag{
|
||||
// Deprecated to be implemented using GRPC
|
||||
@@ -28,10 +32,10 @@ var AppConfigFlags = []cli.Flag{
|
||||
EnvVars: []string{"CREATE_VM"},
|
||||
Destination: &IpAddress,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "FilePath",
|
||||
Usage: "Testing for absolute path",
|
||||
Destination: &Abspath,
|
||||
&cli.StringFlag{
|
||||
Name: "Ports",
|
||||
Usage: "Number of ports to open for the Docker Container",
|
||||
EnvVars: []string{"NUM_PORTS"},
|
||||
Destination: &Ports,
|
||||
},
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user