@@ -1230,19 +1230,19 @@ instance ToJSON DeviceRate where
12301230 , "Rate" .= r
12311231 ]
12321232
1233−data MemoryConstraintSize = B | M | GB deriving (Eq, Show)
1233+data MemoryConstraintSize = B | MB | GB deriving (Eq, Show)
12341234
12351235data MemoryConstraint = MemoryConstraint Integer MemoryConstraintSize deriving (Eq, Show)
12361236
12371237instance ToJSON MemoryConstraint where
12381238 toJSON (MemoryConstraint x B) = toJSON x
1239− toJSON (MemoryConstraint x M) = toJSON $ x * 1024
1240− toJSON (MemoryConstraint x GB) = toJSON $ x * 1024 * 1024
1239+ toJSON (MemoryConstraint x MB) = toJSON $ x * 1024 * 1024
1240+ toJSON (MemoryConstraint x GB) = toJSON $ x * 1024 * 1024 * 1024
12411241
12421242instance FromJSON MemoryConstraint where
12431243 parseJSON (JSON.Number x) = case (floatingOrInteger x) of
1244− Left _ -> fail "Failed to parse MemoryConstraint"
1245− Right i -> return $ MemoryConstraint i B -- | The docker daemon will always return the number as bytes (integer), regardless of how we set them (using M or GB)
1244+ Left (_ :: Double) -> fail "Failed to parse MemoryConstraint"
1245+ Right i -> return $ MemoryConstraint i B -- | The docker daemon will always return the number as bytes (integer), regardless of how we set them (using MB or GB)
12461246 parseJSON _ = fail "Failed to parse MemoryConstraint"
12471247
12481248data ContainerResources = ContainerResources {