on master help sign in
export defaultContainerConfig and rename a few things
5241d7aJames Parker
src/Docker/Types.hs+11−10
@@ -29,8 +29,6 @@ module Docker.Types (
29 , Image(..)
29 , Image(..)
30 , dropImagePrefix
30 , dropImagePrefix
31 , CreateOpts(..)
31 , CreateOpts(..)
32− , cResources
33− , hConfig
34 , defaultCreateOpts
32 , defaultCreateOpts
35 , DetachKeys(..)
33 , DetachKeys(..)
36 , StartOpts(..)
34 , StartOpts(..)
@@ -64,13 +62,16 @@ module Docker.Types (
64 , Isolation(..)
62 , Isolation(..)
65 , UTSMode(..)
63 , UTSMode(..)
66 , HostConfig(..)
64 , HostConfig(..)
65+ , defaultHostConfig
67 , Ulimit(..)
66 , Ulimit(..)
68 , ContainerResources(..)
67 , ContainerResources(..)
68+ , defaultContainerResources
69 , Port
69 , Port
70 , Name
70 , Name
71 , Value
71 , Value
72 , EnvVar(..)
72 , EnvVar(..)
73 , ContainerConfig(..)
73 , ContainerConfig(..)
74+ , defaultContainerConfig
74 , ExposedPorts(..)
75 , ExposedPorts(..)
75 ) where
76 ) where
76
77
@@ -529,8 +530,8 @@ instance ToJSON CreateOpts where
529 JSON.Object $ HM.insert "HostConfig" hcJSON o
530 JSON.Object $ HM.insert "HostConfig" hcJSON o
530 _ -> error "ContainerConfig is not an object." -- This should never happen.
531 _ -> error "ContainerConfig is not an object." -- This should never happen.
531
532
532−cConfig :: Text -> ContainerConfig
533+defaultContainerConfig :: Text -> ContainerConfig
533−cConfig imageName = ContainerConfig {
534+defaultContainerConfig imageName = ContainerConfig {
534 hostname=Nothing
535 hostname=Nothing
535 , domainname=Nothing
536 , domainname=Nothing
536 , user=Nothing
537 , user=Nothing
@@ -553,8 +554,8 @@ cConfig imageName = ContainerConfig {
553 , stopSignal=SIGTERM
554 , stopSignal=SIGTERM
554 }
555 }
555
556
556−hConfig :: HostConfig
557+defaultHostConfig :: HostConfig
557−hConfig = HostConfig {
558+defaultHostConfig = HostConfig {
558 binds=[]
559 binds=[]
559 , containerIDFile=Nothing
560 , containerIDFile=Nothing
560 , logConfig=LogDriverConfig JsonFile Nothing
561 , logConfig=LogDriverConfig JsonFile Nothing
@@ -577,11 +578,11 @@ hConfig = HostConfig {
577 , readOnlyRootfs=False
578 , readOnlyRootfs=False
578 , securityOpt=[]
579 , securityOpt=[]
579 , shmSize=Nothing
580 , shmSize=Nothing
580− , resources=cResources
581+ , resources=defaultContainerResources
581 }
582 }
582
583
583−cResources :: ContainerResources
584+defaultContainerResources :: ContainerResources
584−cResources = ContainerResources {
585+defaultContainerResources = ContainerResources {
585 cpuShares=Nothing
586 cpuShares=Nothing
586 , blkioWeight=Nothing
587 , blkioWeight=Nothing
587 , blkioWeightDevice=Nothing
588 , blkioWeightDevice=Nothing
@@ -603,7 +604,7 @@ cResources = ContainerResources {
603
604
604
605
605defaultCreateOpts :: T.Text -> CreateOpts
606defaultCreateOpts :: T.Text -> CreateOpts
606−defaultCreateOpts imageName = CreateOpts { containerConfig = cConfig imageName, hostConfig = hConfig }
607+defaultCreateOpts imageName = CreateOpts { containerConfig = defaultContainerConfig imageName, hostConfig = defaultHostConfig }
607
608
608-- detachKeys – Override the key sequence for detaching a container.
609-- detachKeys – Override the key sequence for detaching a container.
609-- Format is a single character [a-Z] or ctrl-<value> where <value> is one of: a-z, @, ^, [, , or _.
610-- Format is a single character [a-Z] or ctrl-<value> where <value> is one of: a-z, @, ^, [, , or _.