Documentation ¶
Index ¶
- Constants
- Variables
- func DisplaySessionType() (sessionType string)
- func Docker(opts *[]string) (cmd *exec.Cmd)
- func DockerCmd(opts *[]string) error
- func DockerOutput(opts *[]string) ([]byte, error)
- func DockerXHostAuth() error
- func ListContainers(verbose bool) error
- func ListImages(verbose bool) error
- func ListVolumes() error
- func ParseStatus(code int) string
- func PrintDockerHelp(cmdArgs *[]string, dockerCmd string, helpString string) (helpRequested bool, err error)
- type Configuration
- type Container
- func (container *Container) Cmd(command string) error
- func (container *Container) Create(startContainer bool) error
- func (container *Container) Down() (err error)
- func (container *Container) Name() string
- func (container *Container) Prop(fieldID string) (string, error)
- func (container *Container) Status() (int, error)
- func (container *Container) Up() error
- type PermConfiguration
- type UserConfiguration
Constants ¶
const ConfigFileName = "ahab.json"
ConfigFileName holds the name of the config file
const ContainerUserName = "ahab"
ContainerUserName is the username of the user created in the container
const UserConfigFilePath = ".config/ahab/config.json"
UserConfigFilePath holds the path of the user's config file, relative to their home dir
Variables ¶
var Version string
Version holds the build-time ahab version
Functions ¶
func DisplaySessionType ¶
func DisplaySessionType() (sessionType string)
DisplaySessionType returns the host's session type (x11, wayland, etc.)
func DockerCmd ¶
DockerCmd prints a function, runs it, and attatches the output to the user's terminal
func DockerOutput ¶
DockerOutput runs a docker function behind the scenes and returns the output
func DockerXHostAuth ¶
func DockerXHostAuth() error
DockerXHostAuth gives the docker user xhost access so containerized apps can run on the host's WM TODO: check if the Docker user already has access before re-granting access
func ListContainers ¶
ListContainers executes a docker command to list all containers
func ListImages ¶
ListImages executes a docker command to list all images
func ListVolumes ¶
func ListVolumes() error
ListVolumes executes a docker command to list all images
func ParseStatus ¶
ParseStatus returns the readable string of the passed container status 0 - not found 1 - created 2 - restarting 3 - running 4 - removing 5 - paused 6 - exited 7 - dead
Types ¶
type Configuration ¶
type Configuration struct { AhabVersion string `json:"ahab"` BuildContext string `json:"buildContext"` Command string `json:"command"` Dockerfile string `json:"dockerfile"` Entrypoint string `json:"entrypoint"` Environment []string `json:"environment"` Hostname string `json:"hostname"` ImageURI string `json:"image"` Init []string `json:"init"` Name string `json:"name"` Options []string `json:"options"` Permissions PermConfiguration `json:"permissions"` RestartAfterSetup bool `json:"restartAfterSetup"` User string `json:"user"` Volumes []string `json:"volumes"` Workdir string `json:"workdir"` }
Configuration contains docker config fields
type Container ¶
type Container struct { Fields *Configuration FilePath string }
Container contains all information regarding a container's configuration
func GetContainer ¶
GetContainer retrieves all container info relative to the working directory
func (*Container) Create ¶
Create creates & prepares the container, leaving at "created" status if start is false
type PermConfiguration ¶
type PermConfiguration struct { CmdSet string `json:"cmdSet"` Disable bool `json:"disable"` Groups []string `json:"groups"` }
PermConfiguration contains information regarding container user permissions setup
type UserConfiguration ¶
type UserConfiguration struct { Environment []string `json:"environment"` Options []string `json:"options"` HideCommands bool `json:"hideCommands"` Volumes []string `json:"volumes"` }
UserConfiguration contains global user config fields
func UserConfig ¶
func UserConfig() (userConfig *UserConfiguration, err error)
UserConfig finds and parses the user's docker config file If the user's config is not found, an empty userConfig is returned