docker-client-0.1.0: Funflow's internal docker engine client
Safe HaskellNone
LanguageHaskell2010

Docker.API.Client.Internal.Requests

Description

Functions for sending HTTP requests to the Docker Engine API

Synopsis

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

runContainer Source #

Arguments

:: Manager

The connection manager for the docker daemon. You can newDefaultDockerManager to get a default connection manager based on your operating system.

-> 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.

awaitContainer Source #

Arguments

:: Manager

The connection manager for the docker daemon. You can newDefaultDockerManager to get a default connection manager based on your operating system.

-> 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.

saveContainerArchive Source #

Arguments

:: 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.

pullImage Source #

Arguments

:: 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).

saveContainerLogs Source #

Arguments

:: 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).

printContainerLogs Source #

Arguments

:: 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

removeContainer Source #

Arguments

:: 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