docker

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 27, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close() error

Close closes the Docker client

func ContainerExists

func ContainerExists(containerID string) bool

ContainerExists checks if a container exists

func CreateContainer

func CreateContainer(dbType, displayName, username, password, port, volumeType, volumePath string) (string, error)

CreateContainer creates and starts a database container

func CreateUser

func CreateUser(containerID, dbType, username, password, dbName string) error

CreateUser creates a new user in the database

func DeleteUser

func DeleteUser(containerID, dbType, username, dbName string) error

DeleteUser deletes a user from the database

func ExecCommand

func ExecCommand(containerName string, cmd []string) (string, error)

ExecCommand executes a command in a container and returns the output

func ExecInContainer

func ExecInContainer(containerID string, cmd []string) error

ExecInContainer executes a command in a running container

func FindAvailablePort

func FindAvailablePort(startPort string) (string, error)

FindAvailablePort finds the next available port starting from the default port Returns the available port as a string

func GetActualVersion

func GetActualVersion(containerID, dbType string) (string, error)

GetActualVersion retrieves the actual database version from a running container

func GetConfigFileName

func GetConfigFileName(dbType string) string

GetConfigFileName returns the main config file name for the database type

func GetContainerStatus

func GetContainerStatus(containerID string) (string, error)

GetContainerStatus returns the status of a container

func Initialize

func Initialize() error

Initialize creates a Docker client

func IsPortAvailable

func IsPortAvailable(port string) (bool, error)

IsPortAvailable checks if a port is available on the host

func RemoveContainer

func RemoveContainer(containerID string) error

RemoveContainer removes a container

func RemoveVolume

func RemoveVolume(volumePath string) error

RemoveVolume removes a volume

func RestartContainer

func RestartContainer(containerID string) error

RestartContainer restarts a container

func RotatePassword

func RotatePassword(containerID, dbType, username, newPassword, dbName string) error

RotatePassword rotates a user's password

func StartContainer

func StartContainer(containerID string) error

StartContainer starts an existing container

func StopContainer

func StopContainer(containerID string) error

StopContainer stops a container gracefully

Types

type DBConfig

type DBConfig struct {
	Image       string
	DefaultPort string
	EnvVars     map[string]string
}

DBConfig represents database-specific configuration

func GetDBConfig

func GetDBConfig(dbType, version string) *DBConfig

GetDBConfig returns the configuration for a database type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL