cc

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package cc provides the options for the container config.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fail

Fail is a function that returns an error

note: this is useful for when you want to fail the container config and append the error to the container config error collection

func Failf

func Failf(stringFormat string, args ...any) create.SetContainerConfig

Failf is a function that returns an error

note: this is useful for when you want to fail the container config and append the error to the container config error collection

func WithAttachedStderr

func WithAttachedStderr() create.SetContainerConfig

WithAttachedStderr enables attaching to container's standard error

func WithAttachedStdin

func WithAttachedStdin() create.SetContainerConfig

WithAttachedStdin enables attaching to container's standard input

func WithAttachedStdout

func WithAttachedStdout() create.SetContainerConfig

WithAttachedStdout enables attaching to container's standard output

func WithCommand

func WithCommand(cmd ...string) create.SetContainerConfig

WithCommand appends the command to be run in the container Parameters:

  • cmd: command and its arguments

func WithDisabledHealthCheck

func WithDisabledHealthCheck() create.SetContainerConfig

WithDisabledHealthCheck disables the health check by setting it to NONE.

func WithDisabledNetwork

func WithDisabledNetwork() create.SetContainerConfig

WithDisabledNetwork disables networking for the container

func WithDomainName

func WithDomainName(domainname string) create.SetContainerConfig

WithDomainName sets the domain name of the container

func WithEntrypoint

func WithEntrypoint(entrypoint ...string) create.SetContainerConfig

WithEntrypoint sets the entrypoint to be run within the container

func WithEnv

func WithEnv(key string, value string) create.SetContainerConfig

WithEnv appends an environment variable and its value to the container configuration Parameters:

  • key: environment variable name
  • value: environment variable value

func WithEnvMap added in v0.1.4

func WithEnvMap(env map[string]string) create.SetContainerConfig

WithEnvMap appends a map of environment variables to the container configuration Parameters:

  • env: map of environment variables

func WithEscapedArgs

func WithEscapedArgs() create.SetContainerConfig

WithEscapedArgs indicates that command arguments are already escaped

func WithExposedPort

func WithExposedPort(protocol string, port string) create.SetContainerConfig

WithExposedPort appends a port to be exposed from the container Parameter:

  • port: port number or port range to be exposed in the container (e.g., "80-1000" or "80")
  • protocol: protocol to be exposed from the container

func WithHealthCheck

func WithHealthCheck(setters ...health.SetHealthcheckConfig) create.SetContainerConfig

WithHealthCheck sets the health check for the container parameters:

  • healthCheckFns: the health check functions to set

func WithHostName

func WithHostName(hostname string) create.SetContainerConfig

WithHostName sets the hostname of the container

func WithImage

func WithImage(image string) create.SetContainerConfig

WithImage sets the image to use for the container

func WithImagef

func WithImagef(stringFormat string, args ...any) create.SetContainerConfig

func WithLabel

func WithLabel(label, value string) create.SetContainerConfig

WithLabel appends a label to the container Parameters:

  • label: label key
  • value: label value

func WithMacAddress deprecated

func WithMacAddress(macAddress string) create.SetContainerConfig

WithMacAddress sets the MAC address for the container Parameter:

  • macAddress: MAC address to be used for the container

Deprecated: this function is deprecated since docker API v1.44. Use nc.WithMacAddress(string) instead.

func WithOnBuild

func WithOnBuild(args ...string) create.SetContainerConfig

WithOnBuild appends ONBUILD metadata that will trigger when the image is used as a base image

func WithShell

func WithShell(shell ...string) create.SetContainerConfig

WithShell sets the shell for shell-form of RUN, CMD, ENTRYPOINT

func WithStdinOnce

func WithStdinOnce() create.SetContainerConfig

WithStdinOnce closes STDIN after the first attach

func WithStdinOpen

func WithStdinOpen() create.SetContainerConfig

WithStdinOpen keeps STDIN open even if not attached

func WithStopSignal

func WithStopSignal(signal string) create.SetContainerConfig

WithStopSignal sets the signal that will be used to stop the container

func WithStopTimeout

func WithStopTimeout(timeout int) create.SetContainerConfig

WithStopTimeout sets the timeout (in seconds) to stop the container

note: is also stop_grace_period in compose

func WithTty

func WithTty() create.SetContainerConfig

WithTty allocates a pseudo-TTY for the container

func WithUser

func WithUser(user string) create.SetContainerConfig

WithUser sets the user that commands are run as inside the container

func WithVolume

func WithVolume(volume string) create.SetContainerConfig

WithVolume appends a short hand volume mount point to the container Parameter:

  • volume: path where the volume should be mounted

note: will not work within service config for compose file use hc.WithRWHostBindMount or other mount setter functions instead

func WithWorkingDir

func WithWorkingDir(dir string) create.SetContainerConfig

WithWorkingDir sets the working directory for commands to run in

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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