@@ -19,9 +19,9 @@ module Docker.Client.Api (
19 -- * Images
19 -- * Images
20 , listImages
20 , listImages
21 , buildImageFromDockerfile
21 , buildImageFromDockerfile
22 -- * Other
23 -- * Other
23 , getDockerVersion
24 , getDockerVersion
27import Control.Monad.Catch (MonadMask (..))
27import Control.Monad.Catch (MonadMask (..))
@@ -164,14 +164,30 @@ inspectContainer cid = requestHelper GET (InspectContainerEndpoint cid) >>= pars
164getContainerLogs :: forall m. (MonadIO m, MonadMask m) => LogOpts -> ContainerID -> DockerT m (Either DockerError BSL.ByteString)
164getContainerLogs :: forall m. (MonadIO m, MonadMask m) => LogOpts -> ContainerID -> DockerT m (Either DockerError BSL.ByteString)
165getContainerLogs logopts cid = requestHelper GET (ContainerLogsEndpoint logopts False cid)
165getContainerLogs logopts cid = requestHelper GET (ContainerLogsEndpoint logopts False cid)
167−-- | Continuosly gets the container's logs as a stream. Uses conduit.
167+{-| Continuously gets the container's logs as a stream. Uses conduit.
172+>>> import Docker.Client
173+>>> import Data.Maybe
175+>>> h <- defaultHttpHanlder
176+>>> let cid = fromJust $ toContainerID "fee86e1d522b"
177+>>> runDockerT (defaultClientOpts, h) $ getContainerLogsStream defaultLogOpts cid stdoutC
168getContainerLogsStream :: forall m b . (MonadIO m, MonadMask m) => LogOpts -> ContainerID -> Sink BS.ByteString m b -> DockerT m (Either DockerError b)
181getContainerLogsStream :: forall m b . (MonadIO m, MonadMask m) => LogOpts -> ContainerID -> Sink BS.ByteString m b -> DockerT m (Either DockerError b)
169getContainerLogsStream logopts cid = requestHelper' GET (ContainerLogsEndpoint logopts True cid)
182getContainerLogsStream logopts cid = requestHelper' GET (ContainerLogsEndpoint logopts True cid)
170-- JP: Should the second (follow) argument be True? XXX
183-- JP: Should the second (follow) argument be True? XXX
172-- | Build an Image from a Dockerfile
185-- | Build an Image from a Dockerfile
173-- TODO: Add X-Registry-Config
187-- TODO: Add X-Registry-Config
174-- TODO: Add support for remote URLs to a Dockerfile
189-- TODO: Add support for remote URLs to a Dockerfile
175-- TODO: Clean up temp tar.gz file after the image is built
191-- TODO: Clean up temp tar.gz file after the image is built
176buildImageFromDockerfile :: forall m. (MonadIO m, MonadMask m) => BuildOpts -> FilePath -> DockerT m (Either DockerError ())
192buildImageFromDockerfile :: forall m. (MonadIO m, MonadMask m) => BuildOpts -> FilePath -> DockerT m (Either DockerError ())
177buildImageFromDockerfile opts base = do
193buildImageFromDockerfile opts base = do
@@ -181,8 +197,10 @@ buildImageFromDockerfile opts base = do
181 Right c -> requestUnit POST (BuildImageEndpoint opts c)
197 Right c -> requestUnit POST (BuildImageEndpoint opts c)
183-- | Pulls an image from Docker Hub (by default).
199-- | Pulls an image from Docker Hub (by default).
184-- TODO: Add support for X-Registry-Auth and pulling from private docker
201-- TODO: Add support for X-Registry-Auth and pulling from private docker
185-- registries.
202-- registries.
186-- TODO: Implement importImage function that uses he same
204-- TODO: Implement importImage function that uses he same
187-- CreateImageEndpoint but rather than pulling from docker hub it imports
205-- CreateImageEndpoint but rather than pulling from docker hub it imports
188-- the image from a tarball or a URL.
206-- the image from a tarball or a URL.