Skip to content

Commit e33dd99

Browse files
committed
Fix: docker: fails with usermod error if run as root
1 parent 52bb197 commit e33dd99

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/Stack/Docker.hs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -707,8 +707,8 @@ entrypoint config@Config{..} DockerEntrypoint{..} = do
707707
User.getUserEntryForName stackUserName
708708
-- Switch UID/GID if needed, and update user's home directory
709709
case deUidGid of
710-
Nothing -> updateRootUser envOverride homeDir
711-
Just (0,_) -> updateRootUser envOverride homeDir
710+
Nothing -> return ()
711+
Just (0,_) -> return ()
712712
Just (uid,gid) -> updateOrCreateStackUser envOverride estackUserEntry0 homeDir uid gid
713713
case estackUserEntry0 of
714714
Left _ -> return ()
@@ -744,13 +744,6 @@ entrypoint config@Config{..} DockerEntrypoint{..} = do
744744
copyFile srcIndex destIndex
745745
return True
746746
where
747-
updateRootUser envOverride homeDir = do
748-
-- Adjust the 'root' user's home directory to match HOME environment variable,
749-
-- when running as root or no UID/GID provided
750-
readProcessNull Nothing envOverride "usermod"
751-
["-o"
752-
,"--home",toFilePathNoTrailingSep homeDir
753-
,rootUserName]
754747
updateOrCreateStackUser envOverride estackUserEntry homeDir uid gid = do
755748
case estackUserEntry of
756749
Left _ -> do
@@ -781,7 +774,6 @@ entrypoint config@Config{..} DockerEntrypoint{..} = do
781774
User.setGroupID gid
782775
User.setUserID uid
783776
stackUserName = "stack"::String
784-
rootUserName = "root"::String
785777

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

0 commit comments

Comments
 (0)