Documentation ¶
Index ¶
- func ConvertKVStringsToMap(values []string) map[string]string
- func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *container.HostConfig, *networktypes.NetworkingConfig, ...)
- func ParseDevice(device string) (container.DeviceMapping, error)
- func ParseEnvFile(filename string) ([]string, error)
- func ParseLink(val string) (string, string, error)
- func ParseRestartPolicy(policy string) (container.RestartPolicy, error)
- func ValidDeviceMode(mode string) bool
- func ValidateAttach(val string) (string, error)
- func ValidateDevice(val string) (string, error)
- func ValidateEnv(val string) (string, error)
- func ValidateExtraHost(val string) (string, error)
- func ValidateLink(val string) (string, error)
- func ValidateMACAddress(val string) (string, error)
- func ValidateThrottleBpsDevice(val string) (*blkiodev.ThrottleDevice, error)
- func ValidateThrottleIOpsDevice(val string) (*blkiodev.ThrottleDevice, error)
- func ValidateWeightDevice(val string) (*blkiodev.WeightDevice, error)
- type ContainerOptions
- type ErrBadEnvVariable
- type ThrottledeviceOpt
- type UlimitOpt
- type ValidatorThrottleFctType
- type ValidatorWeightFctType
- type WeightdeviceOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertKVStringsToMap ¶
ConvertKVStringsToMap converts ["key=value"] to {"key":"value"}
func Parse ¶
func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *container.HostConfig, *networktypes.NetworkingConfig, error)
Parse parses the args for the specified command and generates a Config, a HostConfig and returns them with the specified command. If the specified args are not valid, it will return an error.
func ParseDevice ¶
func ParseDevice(device string) (container.DeviceMapping, error)
ParseDevice parses a device mapping string to a container.DeviceMapping struct
func ParseEnvFile ¶
ParseEnvFile reads a file with environment variables enumerated by lines
“Environment variable names used by the utilities in the Shell and Utilities volume of IEEE Std 1003.1-2001 consist solely of uppercase letters, digits, and the '_' (underscore) from the characters defined in Portable Character Set and do not begin with a digit. *But*, other characters may be permitted by an implementation; applications shall tolerate the presence of such names.” -- http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html
As of #16585, it's up to application inside docker to validate or not environment variables, that's why we just strip leading whitespace and nothing more.
func ParseRestartPolicy ¶
func ParseRestartPolicy(policy string) (container.RestartPolicy, error)
ParseRestartPolicy returns the parsed policy or an error indicating what is incorrect
func ValidDeviceMode ¶
ValidDeviceMode checks if the mode for device is valid or not. Valid mode is a composition of r (read), w (write), and m (mknod).
func ValidateAttach ¶
ValidateAttach validates that the specified string is a valid attach option.
func ValidateDevice ¶
ValidateDevice validates a path for devices It will make sure 'val' is in the form:
[host-dir:]container-path[:mode]
It also validates the device mode.
func ValidateEnv ¶
ValidateEnv validates an environment variable and returns it. If no value is specified, it returns the current value using os.Getenv.
As on ParseEnvFile and related to #16585, environment variable names are not validate what so ever, it's up to application inside docker to validate them or not.
func ValidateExtraHost ¶
ValidateExtraHost validates that the specified string is a valid extrahost and returns it. ExtraHost is in the form of name:ip where the ip has to be a valid ip (ipv4 or ipv6).
func ValidateLink ¶
ValidateLink validates that the specified string has a valid link format (containerName:alias).
func ValidateMACAddress ¶
ValidateMACAddress validates a MAC address.
func ValidateThrottleBpsDevice ¶
func ValidateThrottleBpsDevice(val string) (*blkiodev.ThrottleDevice, error)
ValidateThrottleBpsDevice validates that the specified string has a valid device-rate format.
func ValidateThrottleIOpsDevice ¶
func ValidateThrottleIOpsDevice(val string) (*blkiodev.ThrottleDevice, error)
ValidateThrottleIOpsDevice validates that the specified string has a valid device-rate format.
func ValidateWeightDevice ¶
func ValidateWeightDevice(val string) (*blkiodev.WeightDevice, error)
ValidateWeightDevice validates that the specified string has a valid device-weight format.
Types ¶
type ContainerOptions ¶
type ContainerOptions struct { Image string Args []string // contains filtered or unexported fields }
ContainerOptions is a data object with all the options for creating a container TODO: remove fl prefix
func AddFlags ¶
func AddFlags(flags *pflag.FlagSet) *ContainerOptions
AddFlags adds all command line flags that will be used by Parse to the FlagSet
type ErrBadEnvVariable ¶
type ErrBadEnvVariable struct {
// contains filtered or unexported fields
}
ErrBadEnvVariable typed error for bad environment variable
func (ErrBadEnvVariable) Error ¶
func (e ErrBadEnvVariable) Error() string
type ThrottledeviceOpt ¶
type ThrottledeviceOpt struct {
// contains filtered or unexported fields
}
ThrottledeviceOpt defines a map of ThrottleDevices
func NewThrottledeviceOpt ¶
func NewThrottledeviceOpt(validator ValidatorThrottleFctType) ThrottledeviceOpt
NewThrottledeviceOpt creates a new ThrottledeviceOpt
func (*ThrottledeviceOpt) GetList ¶
func (opt *ThrottledeviceOpt) GetList() []*blkiodev.ThrottleDevice
GetList returns a slice of pointers to ThrottleDevices.
func (*ThrottledeviceOpt) Set ¶
func (opt *ThrottledeviceOpt) Set(val string) error
Set validates a ThrottleDevice and sets its name as a key in ThrottledeviceOpt
func (*ThrottledeviceOpt) String ¶
func (opt *ThrottledeviceOpt) String() string
String returns ThrottledeviceOpt values as a string.
func (*ThrottledeviceOpt) Type ¶
func (opt *ThrottledeviceOpt) Type() string
Type returns the option type
type UlimitOpt ¶
type UlimitOpt struct {
// contains filtered or unexported fields
}
UlimitOpt defines a map of Ulimits
func NewUlimitOpt ¶
NewUlimitOpt creates a new UlimitOpt
func (*UlimitOpt) GetList ¶
func (o *UlimitOpt) GetList() []*units.Ulimit
GetList returns a slice of pointers to Ulimits.
type ValidatorThrottleFctType ¶
type ValidatorThrottleFctType func(val string) (*blkiodev.ThrottleDevice, error)
ValidatorThrottleFctType defines a validator function that returns a validated struct and/or an error.
type ValidatorWeightFctType ¶
type ValidatorWeightFctType func(val string) (*blkiodev.WeightDevice, error)
ValidatorWeightFctType defines a validator function that returns a validated struct and/or an error.
type WeightdeviceOpt ¶
type WeightdeviceOpt struct {
// contains filtered or unexported fields
}
WeightdeviceOpt defines a map of WeightDevices
func NewWeightdeviceOpt ¶
func NewWeightdeviceOpt(validator ValidatorWeightFctType) WeightdeviceOpt
NewWeightdeviceOpt creates a new WeightdeviceOpt
func (*WeightdeviceOpt) GetList ¶
func (opt *WeightdeviceOpt) GetList() []*blkiodev.WeightDevice
GetList returns a slice of pointers to WeightDevices.
func (*WeightdeviceOpt) Set ¶
func (opt *WeightdeviceOpt) Set(val string) error
Set validates a WeightDevice and sets its name as a key in WeightdeviceOpt
func (*WeightdeviceOpt) String ¶
func (opt *WeightdeviceOpt) String() string
String returns WeightdeviceOpt values as a string.
func (*WeightdeviceOpt) Type ¶
func (opt *WeightdeviceOpt) Type() string
Type returns the option type