@@ -624,9 +624,12 @@ instance ToJSON EndpointConfig where
624 [ "Aliases" .= aliases
624 [ "Aliases" .= aliases
627+-- | Alias for endpoint name
628+type EndpointName = Text
627-- | Data type for the NetworkingConfig section of the container settings
630-- | Data type for the NetworkingConfig section of the container settings
628newtype NetworkingConfig = NetworkingConfig
631newtype NetworkingConfig = NetworkingConfig
629− { endpointsConfig :: HM.HashMap Text EndpointConfig
632+ { endpointsConfig :: HM.HashMap EndpointName EndpointConfig
630 } deriving (Eq, Show)
633 } deriving (Eq, Show)
632instance ToJSON NetworkingConfig where
635instance ToJSON NetworkingConfig where
@@ -636,9 +639,9 @@ instance ToJSON NetworkingConfig where
637-- | Options used for creating a Container.
640-- | Options used for creating a Container.
638data CreateOpts = CreateOpts {
641data CreateOpts = CreateOpts {
639− containerConfig :: ContainerConfig
642+ containerConfig :: ContainerConfig
640− , hostConfig :: HostConfig
643+ , hostConfig :: HostConfig
641− , networkingConfig :: Maybe NetworkingConfig
644+ , networkingConfig :: NetworkingConfig
642 } deriving (Eq, Show)
645 } deriving (Eq, Show)
644instance ToJSON CreateOpts where
647instance ToJSON CreateOpts where
@@ -648,9 +651,7 @@ instance ToJSON CreateOpts where
648 case ccJSON of
651 case ccJSON of
649 JSON.Object (o :: HM.HashMap T.Text JSON.Value) -> do
652 JSON.Object (o :: HM.HashMap T.Text JSON.Value) -> do
650 let o1 = HM.insert "HostConfig" hcJSON o
653 let o1 = HM.insert "HostConfig" hcJSON o
653− Just _ -> HM.insert "NetworkingConfig" (toJSON nc) o1
654+ let o2 = HM.insert "NetworkingConfig" (toJSON nc) o1
654 JSON.Object o2
655 JSON.Object o2
655 _ -> error "ContainerConfig is not an object." -- This should never happen.
656 _ -> error "ContainerConfig is not an object." -- This should never happen.
@@ -736,7 +737,7 @@ defaultCreateOpts :: T.Text -> CreateOpts
736defaultCreateOpts imageName = CreateOpts
737defaultCreateOpts imageName = CreateOpts
737 { containerConfig = defaultContainerConfig imageName
738 { containerConfig = defaultContainerConfig imageName
738 , hostConfig = defaultHostConfig
739 , hostConfig = defaultHostConfig
739− , networkingConfig = Nothing
740+ , networkingConfig = NetworkingConfig HM.empty
742-- | Override the key sequence for detaching a container.
743-- | Override the key sequence for detaching a container.