Safe Haskell | None |
---|---|
Language | Haskell2010 |
Functions for sending HTTP requests to the Docker Engine API
Synopsis
- dockerAPIVersion :: String
- formatRequestError :: Status -> ByteString -> String
- runContainer :: Manager -> ContainerSpec -> ClientErrorMonad ContainerId
- awaitContainer :: Manager -> ContainerId -> ClientErrorMonad ()
- saveContainerArchive :: Manager -> UserID -> GroupID -> FilePath -> FilePath -> ContainerId -> ClientErrorMonad ()
- pullImage :: Manager -> Text -> ClientErrorMonad ()
- saveContainerLogs :: Manager -> ContainerLogType -> FilePath -> ContainerId -> ClientErrorMonad ()
- printContainerLogs :: Manager -> ContainerLogType -> ContainerId -> ClientErrorMonad ()
- submitCreateContainer :: Manager -> CreateContainer -> ClientErrorMonad ByteString
- startContainer :: Manager -> ContainerId -> ClientErrorMonad ContainerId
- submitWaitContainer :: Manager -> ContainerId -> ClientErrorMonad ByteString
- removeContainer :: Manager -> Bool -> Bool -> ContainerId -> ClientErrorMonad ContainerId
- parseCreateContainerResult :: ByteString -> ClientErrorMonad ContainerId
- parseWaitContainerResult :: ByteString -> ClientErrorMonad WaitContainerResponse
- checkExitStatusCode :: WaitContainerResponse -> ClientErrorMonad ()
Documentation
dockerAPIVersion :: String Source #
Docker Engine API version. This value will prefix all docker api url paths.
formatRequestError :: Status -> ByteString -> String Source #
Helper function which formats the response of a failed HTTP request
:: 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. 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 |
-> 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 |
-> 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 |
-> 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 |
-> 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.
submitCreateContainer :: Manager -> CreateContainer -> ClientErrorMonad ByteString Source #
Attempts to create a docker container, returning the new container's id
:: 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
parseCreateContainerResult :: ByteString -> ClientErrorMonad ContainerId Source #
Parses the response body of a create container request
parseWaitContainerResult :: ByteString -> ClientErrorMonad WaitContainerResponse Source #
Parses the response body of an await container request
checkExitStatusCode :: WaitContainerResponse -> ClientErrorMonad () Source #
Checks the status code value of a WaitContainerResponse