func (d *Docker) RenameContainer(id, newName string) error {
	return d.ContainerRename(context.TODO(), id, newName)
}
RenameContainer rename container
package docker
import (
	"context"
	"io"
	"os"
	"strings"
	"github.com/docker/docker/api/types"
	"github.com/docker/docker/api/types/container"
	"github.com/docker/docker/api/types/mount"
	"github.com/docker/docker/api/types/network"
	"github.com/docker/go-connections/nat"
	"github.com/skanehira/docui/common"
	"github.com/skanehira/docui/docker/streamer"
)
type CreateContainerOptions struct {
	Config        *container.Config
	HostConfig    *container.HostConfig
	NetworkConfig *network.NetworkingConfig
	Name          string
}
func (d *Docker) Containers(opt types.ContainerListOptions) ([]types.Container, error) {
	return d.ContainerList(context.TODO(), opt)
}
func (d *Docker) InspectContainer(name string) (types.ContainerJSON, error) {
	container, _, err := d.ContainerInspectWithRaw(context.TODO(), name, false)
	return container, err
}
func (d *Docker) CreateContainer(opt CreateContainerOptions) error {
	_, err := d.ContainerCreate(context.TODO(), opt.Config, opt.HostConfig, opt.NetworkConfig, opt.Name)
	return err
}
func (d *Docker) NewContainerOptions(config map[string]string, isAttach bool) (CreateContainerOptions, error) {
	options := CreateContainerOptions{
		Config:     &container.Config{},
		HostConfig: &container.HostConfig{},
	}
	options.Config.Image = config["Image"]
	options.Name = config["Name"]
	image, _, err := d.ImageInspectWithRaw(context.TODO(), options.Config.Image)
	if user := config["User"]; user != "" {
		options.Config.User = user
	}
	if err != nil {
		return options, err
	}
	options.Config.Env = image.Config.Env
	port := config["Port"]
	hostPort := config["HostPort"]
	ip := config["HostIP"]
	if ip == "" {
		ip = "0.0.0.0"
	}
	if port != "" && hostPort != "" {
		options.HostConfig.PortBindings = nat.PortMap{
			nat.Port(port + "/tcp"): {
				{
					HostIP:   ip,
					HostPort: hostPort,
				},
			},
		}
	}
	if cmd := config["Cmd"]; cmd != "" {
		cmds := strings.Split(cmd, ",")
		for _, c := range cmds {
			options.Config.Cmd = append(options.Config.Cmd, c)
		}
	}
	if env := config["Env"]; env != "" {
		for _, v := range strings.Split(env, ",") {
			v = common.GetOSenv(v)
			options.Config.Env = append(options.Config.Env, v)
		}
	}
	hostVolume := config["HostVolume"]
	volume := config["Volume"]
	if hostVolume != "" && volume != "" {
		options.HostConfig.Mounts = []mount.Mount{
			{
				Target: volume,
				Source: hostVolume,
				Type:   mount.Type(config["VolumeType"]),
			},
		}
	}
	options.Config.AttachStdout = true
	options.Config.AttachStderr = true
	if isAttach {
		options.Config.Tty = true
		options.Config.AttachStdin = true
		options.Config.OpenStdin = true
	}
	return options, nil
}
func (d *Docker) CommitContainer(name string, opt types.ContainerCommitOptions) error {
	_, err := d.ContainerCommit(context.TODO(), name, opt)
	return err
}
func (d *Docker) RemoveContainer(name string) error {
	return d.ContainerRemove(context.TODO(), name, types.ContainerRemoveOptions{})
}
func (d *Docker) KillContainer(name string) error {
	return d.ContainerKill(context.TODO(), name, "KILL")
}