func ResizeContainer(cont string, mem int64, cpu float64) (string, error) {
    ctx := context.Background()
    cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
    if err != nil {
        return "", err
    }
    defer cli.Close()

    _, err = cli.ContainerUpdate(ctx, cont, container.UpdateConfig{
        Resources: container.Resources{
            Memory: mem,
            NanoCPUs: int64(cpu*(math.Pow(10, 9))),
        },
    });
    if err != nil {
        return "", err
    }

    return "success", nil
}
// resizing a container instance on the fly
resizing a container instance on the fly
// resizing a container instance on the fly
func ResizeContainer(cont string, mem int64, cpu float64) (string, error) {
    ctx := context.Background()
    cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
    if err != nil {
        return "", err
    }
    defer cli.Close()
    _, err = cli.ContainerUpdate(ctx, cont, container.UpdateConfig{
        Resources: container.Resources{
            Memory: mem,
            NanoCPUs: int64(cpu*(math.Pow(10, 9))),
        },
    });
    if err != nil {
        return "", err
    }
    return "success", nil
}
func ResizeContainer ( cont string , mem int64 , cpu float64 ) ( string , error ) { ctx := context . Background ( ) cli , err := client . NewClientWithOpts ( client . FromEnv , client . WithAPIVersionNegotiation ( ) ) if err != nil { return " " , err } defer cli . Close ( ) _ , err = cli . ContainerUpdate ( ctx , cont , container . UpdateConfig { Resources : container . Resources { Memory : mem , NanoCPUs : int64 ( cpu * ( math . Pow ( 10 , 9 ) ) ) , } , } ) ; if err != nil { return " " , err } return " " , nil }
resizing a container instance on the fly
resizing a container instance on the fly