stack-1.4.0: The Haskell Tool Stack

Safe Haskell | None
Language | Haskell2010

Stack.Types.Docker

Description

Docker types.

Synopsis

- data DockerOpts = DockerOpts {
  - dockerEnable :: !Bool
  - dockerImage :: !String
  - dockerRegistryLogin :: !Bool
  - dockerRegistryUsername :: !(Maybe String)
  - dockerRegistryPassword :: !(Maybe String)
  - dockerAutoPull :: !Bool
  - dockerDetach :: !Bool
  - dockerPersist :: !Bool
  - dockerContainerName :: !(Maybe String)
  - dockerRunArgs :: ![String]
  - dockerMount :: ![Mount]
  - dockerEnv :: ![String]
  - dockerDatabasePath :: !(Path Abs File)
  - dockerStackExe :: !(Maybe DockerStackExe)
  - dockerSetUser :: !(Maybe Bool)
  - dockerRequireDockerVersion :: !VersionRange
  }
- data DockerOptsMonoid = DockerOptsMonoid {
  - dockerMonoidDefaultEnable :: !Any
  - dockerMonoidEnable :: !(First Bool)
  - dockerMonoidRepoOrImage :: !(First DockerMonoidRepoOrImage)
  - dockerMonoidRegistryLogin :: !(First Bool)
  - dockerMonoidRegistryUsername :: !(First String)
  - dockerMonoidRegistryPassword :: !(First String)
  - dockerMonoidAutoPull :: !(First Bool)
  - dockerMonoidDetach :: !(First Bool)
  - dockerMonoidPersist :: !(First Bool)
  - dockerMonoidContainerName :: !(First String)
  - dockerMonoidRunArgs :: ![String]
  - dockerMonoidMount :: ![Mount]
  - dockerMonoidEnv :: ![String]
  - dockerMonoidDatabasePath :: !(First (Path Abs File))
  - dockerMonoidStackExe :: !(First DockerStackExe)
  - dockerMonoidSetUser :: !(First Bool)
  - dockerMonoidRequireDockerVersion :: !IntersectingVersionRange
  }
- data DockerStackExe
  - = DockerStackExeDownload
  - | DockerStackExeHost
  - | DockerStackExeImage
  - | DockerStackExePath (Path Abs File)
- parseDockerStackExe :: MonadThrow m => String -> m DockerStackExe
- data Mount = Mount String String
- data DockerMonoidRepoOrImage
  - = DockerMonoidRepo String
  - | DockerMonoidImage String
- newtype VersionRangeJSON = VersionRangeJSON {
  - unVersionRangeJSON :: VersionRange
  }
- data StackDockerException
  - = DockerMustBeEnabledException
  - | OnlyOnHostException
  - | InspectFailedException String
  - | NotPulledException String
  - | InvalidCleanupCommandException String
  - | InvalidImagesOutputException String
  - | InvalidPSOutputException String
  - | InvalidInspectOutputException String
  - | PullFailedException String
  - | DockerTooOldException Version Version
  - | DockerVersionProhibitedException [Version] Version
  - | BadDockerVersionException VersionRange Version
  - | InvalidVersionOutputException
  - | HostStackTooOldException Version (Maybe Version)
  - | ContainerStackTooOldException Version Version
  - | CannotDetermineProjectRootException
  - | DockerNotInstalledException
  - | UnsupportedStackExeHostPlatformException
  - | DockerStackExeParseException String
- dockerEnableArgName :: Text
- dockerRepoArgName :: Text
- dockerImageArgName :: Text
- dockerRegistryLoginArgName :: Text
- dockerRegistryUsernameArgName :: Text
- dockerRegistryPasswordArgName :: Text
- dockerAutoPullArgName :: Text
- dockerDetachArgName :: Text
- dockerRunArgsArgName :: Text
- dockerMountArgName :: Text
- dockerEnvArgName :: Text
- dockerContainerNameArgName :: Text
- dockerPersistArgName :: Text
- dockerDatabasePathArgName :: Text
- dockerStackExeArgName :: Text
- dockerStackExeDownloadVal :: String
- dockerStackExeHostVal :: String
- dockerStackExeImageVal :: String
- dockerSetUserArgName :: Text
- dockerRequireDockerVersionArgName :: Text
- dockerEntrypointArgName :: String
- dockerCmdName :: String
- dockerHelpOptName :: String
- dockerPullCmdName :: String
- dockerCleanupCmdName :: String
- reExecArgName :: String
- dockerContainerPlatform :: Platform

# Documentation

data DockerOpts #

Docker configuration.

Constructors

DockerOpts |
Fields dockerEnable :: !Bool Is using Docker enabled? dockerImage :: !String Exact Docker image tag or ID. Overrides docker-repo-*/tag. dockerRegistryLogin :: !Bool Does registry require login for pulls? dockerRegistryUsername :: !(Maybe String) Optional username for Docker registry. dockerRegistryPassword :: !(Maybe String) Optional password for Docker registry. dockerAutoPull :: !Bool Automatically pull new images. dockerDetach :: !Bool Whether to run a detached container dockerPersist :: !Bool Create a persistent container (don't remove it when finished). Implied by `dockerDetach`. dockerContainerName :: !(Maybe String) Container name to use, only makes sense from command-line with `dockerPersist` or `dockerDetach`. dockerRunArgs :: ![String] Arguments to pass directly to `docker run`. dockerMount :: ![Mount] Volumes to mount in the container. dockerEnv :: ![String] Environment variables to set in the container. dockerDatabasePath :: !(Path Abs File) Location of image usage database. dockerStackExe :: !(Maybe DockerStackExe) Location of container-compatible stack executable dockerSetUser :: !(Maybe Bool) Set in-container user to match host's dockerRequireDockerVersion :: !VersionRange Require a version of Docker within this range.

Instances

Show DockerOpts # |
Methods showsPrec :: Int -> DockerOpts -> ShowS # show :: DockerOpts -> String # showList :: [DockerOpts] -> ShowS #

data DockerOptsMonoid #

An uninterpreted representation of docker options. Configurations may be "cascaded" using mappend (left-biased).

Constructors

DockerOptsMonoid |
Fields dockerMonoidDefaultEnable :: !Any Should Docker be defaulted to enabled (does `docker:` section exist in the config)? dockerMonoidEnable :: !(First Bool) Is using Docker enabled? dockerMonoidRepoOrImage :: !(First DockerMonoidRepoOrImage) Docker repository name (e.g. `fpco/stack-build` or `fpco/stack-full:lts-2.8`) dockerMonoidRegistryLogin :: !(First Bool) Does registry require login for pulls? dockerMonoidRegistryUsername :: !(First String) Optional username for Docker registry. dockerMonoidRegistryPassword :: !(First String) Optional password for Docker registry. dockerMonoidAutoPull :: !(First Bool) Automatically pull new images. dockerMonoidDetach :: !(First Bool) Whether to run a detached container dockerMonoidPersist :: !(First Bool) Create a persistent container (don't remove it when finished). Implied by `dockerDetach`. dockerMonoidContainerName :: !(First String) Container name to use, only makes sense from command-line with `dockerPersist` or `dockerDetach`. dockerMonoidRunArgs :: ![String] Arguments to pass directly to `docker run` dockerMonoidMount :: ![Mount] Volumes to mount in the container dockerMonoidEnv :: ![String] Environment variables to set in the container dockerMonoidDatabasePath :: !(First (Path Abs File)) Location of image usage database. dockerMonoidStackExe :: !(First DockerStackExe) Location of container-compatible stack executable dockerMonoidSetUser :: !(First Bool) Set in-container user to match host's dockerMonoidRequireDockerVersion :: !IntersectingVersionRange See: `dockerRequireDockerVersion`

Instances

Show DockerOptsMonoid # |
Methods showsPrec :: Int -> DockerOptsMonoid -> ShowS # show :: DockerOptsMonoid -> String # showList :: [DockerOptsMonoid] -> ShowS #
Generic DockerOptsMonoid # |
Associated Types type Rep DockerOptsMonoid :: * -> * # Methods from :: DockerOptsMonoid -> Rep DockerOptsMonoid x # to :: Rep DockerOptsMonoid x -> DockerOptsMonoid #
Monoid DockerOptsMonoid # | Left-biased combine Docker options
Methods mempty :: DockerOptsMonoid # mappend :: DockerOptsMonoid -> DockerOptsMonoid -> DockerOptsMonoid # mconcat :: [DockerOptsMonoid] -> DockerOptsMonoid #
FromJSON (WithJSONWarnings DockerOptsMonoid) # | Decode uninterpreted docker options from JSON/YAML.
Methods parseJSON :: Value -> Parser (WithJSONWarnings DockerOptsMonoid) # parseJSONList :: Value -> Parser [WithJSONWarnings DockerOptsMonoid] #
type Rep DockerOptsMonoid # |
type Rep DockerOptsMonoid = D1 (MetaData "DockerOptsMonoid" "Stack.Types.Docker" "stack-1.4.0-5VbagGyw9hyAgBJq8WQvrq" False) (C1 (MetaCons "DockerOptsMonoid" PrefixI True) ((:*:) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "dockerMonoidDefaultEnable") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Any)) (S1 (MetaSel (Just Symbol "dockerMonoidEnable") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First Bool)))) ((:*:) (S1 (MetaSel (Just Symbol "dockerMonoidRepoOrImage") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First DockerMonoidRepoOrImage))) (S1 (MetaSel (Just Symbol "dockerMonoidRegistryLogin") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First Bool))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "dockerMonoidRegistryUsername") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First String))) (S1 (MetaSel (Just Symbol "dockerMonoidRegistryPassword") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First String)))) ((:*:) (S1 (MetaSel (Just Symbol "dockerMonoidAutoPull") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First Bool))) (S1 (MetaSel (Just Symbol "dockerMonoidDetach") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First Bool)))))) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "dockerMonoidPersist") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First Bool))) (S1 (MetaSel (Just Symbol "dockerMonoidContainerName") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First String)))) ((:*:) (S1 (MetaSel (Just Symbol "dockerMonoidRunArgs") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 [String])) (S1 (MetaSel (Just Symbol "dockerMonoidMount") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 [Mount])))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "dockerMonoidEnv") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 [String])) (S1 (MetaSel (Just Symbol "dockerMonoidDatabasePath") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First (Path Abs File))))) ((:*:) (S1 (MetaSel (Just Symbol "dockerMonoidStackExe") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First DockerStackExe))) ((:*:) (S1 (MetaSel (Just Symbol "dockerMonoidSetUser") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First Bool))) (S1 (MetaSel (Just Symbol "dockerMonoidRequireDockerVersion") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 IntersectingVersionRange))))))))

data DockerStackExe #

Where to get the `stack` executable to run in Docker containers

Constructors

DockerStackExeDownload | Download from official bindist
DockerStackExeHost | Host's `stack` (linux-x86_64 only)
DockerStackExeImage | Docker image's `stack` (versions must match)
DockerStackExePath (Path Abs File) | Executable at given path

Instances

Show DockerStackExe # |
Methods showsPrec :: Int -> DockerStackExe -> ShowS # show :: DockerStackExe -> String # showList :: [DockerStackExe] -> ShowS #
FromJSON DockerStackExe # |
Methods parseJSON :: Value -> Parser DockerStackExe # parseJSONList :: Value -> Parser [DockerStackExe] #

parseDockerStackExe :: MonadThrow m => String -> m DockerStackExe #

Parse `DockerStackExe`.

data Mount #

Docker volume mount.

Constructors

Mount String String |

Instances

Read Mount # | For optparse-applicative.
Methods readsPrec :: Int -> ReadS Mount # readList :: ReadS [Mount] # readPrec :: ReadPrec Mount # readListPrec :: ReadPrec [Mount] #
Show Mount # | Show instance.
Methods showsPrec :: Int -> Mount -> ShowS # show :: Mount -> String # showList :: [Mount] -> ShowS #
FromJSON Mount # | For YAML.
Methods parseJSON :: Value -> Parser Mount # parseJSONList :: Value -> Parser [Mount] #

data DockerMonoidRepoOrImage #

Options for Docker repository or image.

Constructors

DockerMonoidRepo String |
DockerMonoidImage String |

Instances

Show DockerMonoidRepoOrImage # |
Methods showsPrec :: Int -> DockerMonoidRepoOrImage -> ShowS # show :: DockerMonoidRepoOrImage -> String # showList :: [DockerMonoidRepoOrImage] -> ShowS #

newtype VersionRangeJSON #

Newtype for non-orphan FromJSON instance.

Constructors

VersionRangeJSON |
Fields unVersionRangeJSON :: VersionRange

Instances

FromJSON VersionRangeJSON # | Parse VersionRange.
Methods parseJSON :: Value -> Parser VersionRangeJSON # parseJSONList :: Value -> Parser [VersionRangeJSON] #

data StackDockerException #

Exceptions thrown by Stack.Docker.

Constructors

DockerMustBeEnabledException | Docker must be enabled to use the command.
OnlyOnHostException | Command must be run on host OS (not in a container).
InspectFailedException String | `docker inspect` failed.
NotPulledException String | Image does not exist.
InvalidCleanupCommandException String | Input to `docker cleanup` has invalid command.
InvalidImagesOutputException String | Invalid output from `docker images`.
InvalidPSOutputException String | Invalid output from `docker ps`.
InvalidInspectOutputException String | Invalid output from `docker inspect`.
PullFailedException String | Could not pull a Docker image.
DockerTooOldException Version Version | Installed version of `docker` below minimum version.
DockerVersionProhibitedException [Version] Version | Installed version of `docker` is prohibited.
BadDockerVersionException VersionRange Version | Installed version of `docker` is out of range specified in config file.
InvalidVersionOutputException | Invalid output from `docker --version`.
HostStackTooOldException Version (Maybe Version) | Version of `stack` on host is too old for version in image.
ContainerStackTooOldException Version Version | Version of `stack` in container/image is too old for version on host.
CannotDetermineProjectRootException | Can't determine the project root (where to put docker sandbox).
DockerNotInstalledException | `docker --version` failed.
UnsupportedStackExeHostPlatformException | Using host stack-exe on unsupported platform.
DockerStackExeParseException String | `stack-exe` option fails to parse.

Instances

Show StackDockerException # |
Methods showsPrec :: Int -> StackDockerException -> ShowS # show :: StackDockerException -> String # showList :: [StackDockerException] -> ShowS #
Exception StackDockerException # |
Methods toException :: StackDockerException -> SomeException # fromException :: SomeException -> Maybe StackDockerException # displayException :: StackDockerException -> String #

dockerEnableArgName :: Text #

Docker enable argument name.

dockerRepoArgName :: Text #

Docker repo arg argument name.

dockerImageArgName :: Text #

Docker image argument name.

dockerRegistryLoginArgName :: Text #

Docker registry login argument name.

dockerRegistryUsernameArgName :: Text #

Docker registry username argument name.

dockerRegistryPasswordArgName :: Text #

Docker registry password argument name.

dockerAutoPullArgName :: Text #

Docker auto-pull argument name.

dockerDetachArgName :: Text #

Docker detach argument name.

dockerRunArgsArgName :: Text #

Docker run args argument name.

dockerMountArgName :: Text #

Docker mount argument name.

dockerEnvArgName :: Text #

Docker environment variable argument name.

dockerContainerNameArgName :: Text #

Docker container name argument name.

dockerPersistArgName :: Text #

Docker persist argument name.

dockerDatabasePathArgName :: Text #

Docker database path argument name.

dockerStackExeArgName :: Text #

Docker database path argument name.

dockerStackExeDownloadVal :: String #

Value for `--docker-stack-exe=download`

dockerStackExeHostVal :: String #

Value for `--docker-stack-exe=host`

dockerStackExeImageVal :: String #

Value for `--docker-stack-exe=image`

dockerSetUserArgName :: Text #

Docker `set-user` argument name

dockerRequireDockerVersionArgName :: Text #

Docker `require-version` argument name

dockerEntrypointArgName :: String #

Argument name used to pass docker entrypoint data (only used internally)

dockerCmdName :: String #

Command-line argument for "docker"

dockerHelpOptName :: String #

dockerPullCmdName :: String #

Command-line argument for `docker pull`.

dockerCleanupCmdName :: String #

Command-line argument for `docker cleanup`.

reExecArgName :: String #

Command-line option for `--internal-re-exec-version`.

dockerContainerPlatform :: Platform #

Platform that Docker containers run