Skip to content

Commit

Permalink
Fix: docker: fails with usermod error if run as root
Browse files Browse the repository at this point in the history
  • Loading branch information
borsboom committed Nov 20, 2015
1 parent 52bb197 commit e33dd99
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/Stack/Docker.hs
Original file line number Diff line number Diff line change
Expand Up @@ -707,8 +707,8 @@ entrypoint config@Config{..} DockerEntrypoint{..} = do
User.getUserEntryForName stackUserName
-- Switch UID/GID if needed, and update user's home directory
case deUidGid of
Nothing -> updateRootUser envOverride homeDir
Just (0,_) -> updateRootUser envOverride homeDir
Nothing -> return ()
Just (0,_) -> return ()
Just (uid,gid) -> updateOrCreateStackUser envOverride estackUserEntry0 homeDir uid gid
case estackUserEntry0 of
Left _ -> return ()
Expand Down Expand Up @@ -744,13 +744,6 @@ entrypoint config@Config{..} DockerEntrypoint{..} = do
copyFile srcIndex destIndex
return True
where
updateRootUser envOverride homeDir = do
-- Adjust the 'root' user's home directory to match HOME environment variable,
-- when running as root or no UID/GID provided
readProcessNull Nothing envOverride "usermod"
["-o"
,"--home",toFilePathNoTrailingSep homeDir
,rootUserName]
updateOrCreateStackUser envOverride estackUserEntry homeDir uid gid = do
case estackUserEntry of
Left _ -> do
Expand Down Expand Up @@ -781,7 +774,6 @@ entrypoint config@Config{..} DockerEntrypoint{..} = do
User.setGroupID gid
User.setUserID uid
stackUserName = "stack"::String
rootUserName = "root"::String

-- | MVar used to ensure the Docker entrypoint is performed exactly once
entrypointMVar :: MVar Bool
Expand Down

0 comments on commit e33dd99

Please sign in to comment.