Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- dockerAPIVersion :: String
- newtype OS = OS String
- defaultDockerUnixSocket :: FilePath
- newDefaultDockerManager :: OS -> IO Manager
- newUnixDomainSocketManager :: FilePath -> IO Manager
- data DockerClientError
- type ClientErrorMonad a = ExceptT DockerClientError IO a
- data ContainerSpec = ContainerSpec {}
- defaultContainerSpec :: Text -> ContainerSpec
- runContainer :: Manager -> ContainerSpec -> ClientErrorMonad ContainerId
- saveContainerArchive :: Manager -> UserID -> GroupID -> FilePath -> FilePath -> ContainerId -> ClientErrorMonad ()
- removeContainer :: Manager -> Bool -> Bool -> ContainerId -> ClientErrorMonad ContainerId
- saveContainerLogs :: Manager -> ContainerLogType -> FilePath -> ContainerId -> ClientErrorMonad ()
- data ContainerLogType
- pullImage :: Manager -> Text -> ClientErrorMonad ()
- awaitContainer :: Manager -> ContainerId -> ClientErrorMonad ()
- printContainerLogs :: Manager -> ContainerLogType -> ContainerId -> ClientErrorMonad ()
Documentation
dockerAPIVersion :: String Source #
Docker Engine API version. This value will prefix all docker api url paths.
defaultDockerUnixSocket :: FilePath Source #
Default docker socket path on unix systems
newDefaultDockerManager :: OS -> IO Manager Source #
Creates a new HTTP connection manager for the default docker daemon address on your system.
newUnixDomainSocketManager :: FilePath -> IO Manager Source #
Creates a new http connection manager from a file path to a unix socket
data DockerClientError Source #
This type describes common errors the docker client might encounter
ContainerCreationFailedError String | The request to create a new container failed |
UnrecognizedJSONResponseError String | The docker engine API responded with something we didn't expect |
GetContainerArchiveError String | The docker engine API responded with an error status code when getting a container archive |
NonZeroExitCode String | The container exited with a nonzero exit code |
GetContainerLogsError String | The docker engine API responded with an error when we attempted to get a container's logs |
ImagePullError String | The docker engine API responded with an error when we attempted to pull an image |
Instances
type ClientErrorMonad a = ExceptT DockerClientError IO a Source #
Wrapper for composing operations which return an Either DockerClientError a
data ContainerSpec Source #
Describes a docker container to be created with runContainer. Use defaultContainerSpec to get a default value.
ContainerSpec | |
|
Instances
:: Text | The container's Docker Image. May optionally include a tag or digest field (e.g. "python:3.6").
If neither a tag or digest is specified the image will default to the |
-> ContainerSpec |
Constructs a simple default ContainerSpec for a docker image which uses the image's default values for all other aguments.
:: Manager | The connection manager for the docker daemon. You can |
-> ContainerSpec | |
-> ClientErrorMonad ContainerId |
Similar to the `docker run` command. Runs a container in the background using the input HTTP connection manager, returning immediately.
To wait for the container to exit use awaitContainer
.
Note that this currently always tries to pull the container's image.
:: Manager | The connection manager for the docker daemon |
-> UserID | The user id to use for output files and directories |
-> GroupID | The group id to use for output files and directories |
-> FilePath | The path in the container to copy |
-> FilePath | The output path at which to write outputs |
-> ContainerId | |
-> ClientErrorMonad () |
Analagous to the `docker cp` command. Recursively copies contents at the specified path in the container to the provided output path on the host, setting file permissions to the specified user and group id. Note that the container must have been started for this to succeed (i.e. it must have a running or finished state). This method uses conduit to optimize memory usage.
:: Manager | The connection manager for the docker daemon |
-> Bool | Enable force removal? |
-> Bool | Also remove container's volumes? |
-> ContainerId | |
-> ClientErrorMonad ContainerId |
Remove a container, equivalent to the `docker container rm` command
:: Manager | The connection manager for the docker daemon |
-> ContainerLogType | Which logs to fetch from the container |
-> FilePath | Output file at which to write logs |
-> ContainerId | |
-> ClientErrorMonad () |
Streams the logs from a docker container into the specified output file path. Logs can include stdout, stderr, or both. Note that if you include both streams, the sorting of the timestamps in the output file may not be perfectly sorted since the stream returned by the docker api is only sorted within each stream type (i.e. stdout and stderr are sorted separately).
:: Manager | The connection manager for the docker daemon |
-> Text | The image of interest. May include an optional tag or digest field. Note that in line with the Docker Engine API, this will pull **ALL** images in a repo if no tag or digest is specified. |
-> ClientErrorMonad () |
Pulls an image from a remote registry (similar to a `docker pull` command). This currently only supports public registries (e.g. DockerHub).
:: Manager | The connection manager for the docker daemon. You can |
-> ContainerId | The container id to await |
-> ClientErrorMonad () |
Waits on a started container (e.g. via runContainer
) until it exits, validating its exit code and returning an DockerClientError
if
the container exited with an error. This will work for both actively running containers and those which have already exited.
:: Manager | The connection manager for the docker daemon |
-> ContainerLogType | Which logs to fetch from the container |
-> ContainerId | |
-> ClientErrorMonad () |
Streams the logs from a docker container, printing them to stdout. Logs can include stdout, stderr, or both.