Add support for setting stacks when creating session (#138)
* Add support for setting stacks when creating session * Add exec endpoint and move dns stuff to another package * Rename command and status code
This commit is contained in:
@@ -274,3 +274,20 @@ func CreateInstance(session *Session, dindImage string) (*Instance, error) {
|
||||
func DeleteContainer(id string) error {
|
||||
return c.ContainerRemove(context.Background(), id, types.ContainerRemoveOptions{Force: true, RemoveVolumes: true})
|
||||
}
|
||||
|
||||
func Exec(instanceName string, command []string) (int, error) {
|
||||
e, err := c.ContainerExecCreate(context.Background(), instanceName, types.ExecConfig{Cmd: command})
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
err = c.ContainerExecStart(context.Background(), e.ID, types.ExecStartCheck{})
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
ins, err := c.ContainerExecInspect(context.Background(), e.ID)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return ins.ExitCode, nil
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user