container

package
v0.0.0-...-8695b4f Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container struct {
	ContainerID string
	ImageName   string
	// contains filtered or unexported fields
}

Container is a wrapper around the Docker client that provides methods for building and running a specific container. It encapsulates the complexity of Docker operations.

func NewContainer

func NewContainer(imageName string) (*Container, error)

NewContainer creates a new Container manager instance. It initializes a Docker client using the host's Docker environment settings.

func (*Container) BuildImage

func (c *Container) BuildImage() error

BuildImage constructs a Docker image from a Dockerfile in the specified directory.

func (*Container) Execute

func (c *Container) Execute(ctx context.Context, cmd []string) (string, error)

Execute executes a command in the running container and returns the output.

func (*Container) IsRunning

func (c *Container) IsRunning(ctx context.Context) bool

IsRunning checks if the container is currently running.

func (*Container) Run

func (c *Container) Run(ctx context.Context, cmd []string, paths []string) error

Run creates and starts a new container.

func (*Container) StopAndRemove

func (c *Container) StopAndRemove(ctx context.Context) error

StopAndRemove terminates and removes the container.

Jump to

Keyboard shortcuts

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