on master help sign in
SSL auth docs
c738795James Parker
src/Docker/Client.hs+27−3
@@ -9,9 +9,9 @@ Maintainer : deni@denibertovic.com
9Stability : experimental
9Stability : experimental
10Portability : POSIX
10Portability : POSIX
11
11
12−Getting started
12+= Getting started
13
13
14−* Creating a container:
14+Creating a container:
15
15
16We're going to create a nginx container and we're going to map port @80@ from within the container to port @8000@ on
16We're going to create a nginx container and we're going to map port @80@ from within the container to port @8000@ on
17the host.
17the host.
@@ -51,11 +51,35 @@ stopNginxContainer cid = runDockerT (defaultClientOpts, defaultHttpHandler) $ do
51
51
52>>> stopNginxContainer cid
52>>> stopNginxContainer cid
53
53
54−* Get Docker API Version:
54+= Get Docker API Version
55
55
56>>> runDockerT (defaultClientOpts, defaultHttpHandler) $ getDockerVersion
56>>> runDockerT (defaultClientOpts, defaultHttpHandler) $ getDockerVersion
57Right (DockerVersion {version = "1.12.0", apiVersion = "1.24", gitCommit = "8eab29e", goVersion = "go1.6.3", os = "linux", arch = "amd64", kernelVersion = "4.6.0-1-amd64", buildTime = "2016-07-28T21:46:40.664812891+00:00"})
57Right (DockerVersion {version = "1.12.0", apiVersion = "1.24", gitCommit = "8eab29e", goVersion = "go1.6.3", os = "linux", arch = "amd64", kernelVersion = "4.6.0-1-amd64", buildTime = "2016-07-28T21:46:40.664812891+00:00"})
58
58
59+= Setup SSL Authentication
60+
61+Let's create a custom 'HttpHandler' that uses a client's certificate and private key for SSL authentication.
62+It also accepts a self-signed CA certificate which is specified via 'clientParamsSetCA'.
63+This handler can replace 'defaultHttpHandler' in the arguments to 'runDockerT'.
64+
65+@
66+let host = "domain.name"
67+let port = fromInteger 4000
68+let privKey = "path\/to\/private\/key"
69+let cert = "path\/to\/certificate"
70+let ca = "path\/to\/CA"
71+paramsE <- clientParamsWithClientAuthentication host port privKey cert
72+case paramsE of
73+ Left err ->
74+ error err
75+ Right params' -> do
76+ params <- clientParamsSetCA params' ca
77+ settings <- HTTP.mkManagerSettings (TLSSettings params) Nothing
78+ manager <- newManager settings
79+ return $ httpHandler manager
80+@
81+
82+
59-}
83-}
60module Docker.Client (
84module Docker.Client (
61 -- * Client functions
85 -- * Client functions