File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ preventInContainer inner =
127127-- | 'True' if we are currently running inside a Docker container.
128128getInContainer :: (MonadIO m ) => m Bool
129129getInContainer =
130- do maybeEnvVar <- liftIO (lookupEnv sandboxIDEnvVar )
130+ do maybeEnvVar <- liftIO (lookupEnv inContainerEnvVar )
131131 case maybeEnvVar of
132132 Nothing -> return False
133133 Just _ -> return True
@@ -212,6 +212,7 @@ runContainerAndExit config
212212 (concat
213213 [[" run"
214214 ," --net=host"
215+ ," -e" ,inContainerEnvVar ++ " =1"
215216 ," -e" ,stackRootEnvVar ++ " =" ++ trimTrailingPathSep stackRoot
216217 ," -e" ," WORK_UID=" ++ uid
217218 ," -e" ," WORK_GID=" ++ gid
@@ -757,6 +758,10 @@ fromMaybeProjectRoot = fromMaybe (throw CannotDetermineProjectRootException)
757758sandboxIDEnvVar :: String
758759sandboxIDEnvVar = " DOCKER_SANDBOX_ID"
759760
761+ -- | Environment variable used to indicate stack is running in container.
762+ inContainerEnvVar :: String
763+ inContainerEnvVar = concat [map toUpper stackProgName," _IN_CONTAINER" ]
764+
760765-- | Command-line argument for "docker"
761766dockerCmdName :: String
762767dockerCmdName = " docker"
You can’t perform that action at this time.
0 commit comments