on master help sign in
Handle stopped docker container properly
commit409abb18437eed96bdf1f8be9827ce3cfd95bfe5 author3noch <eacameron@gmail.com> dateWed 30 May 2018, 13:27 (8 years ago) parent1652c10
1 file changed+5−5
lib/command/src/Obelisk/Command/VmBuilder.hs+5−5
lib/command/src/Obelisk/Command/VmBuilder.hs+5−5
@@ -46,7 +46,7 @@ containerExists :: MonadObelisk m => m Bool
4646containerExists = withExitFailMessage needDockerMsg $ do
4747 containerNames <- fmap (map T.strip . T.lines . T.pack) $
4848 readProcessAndLogStderr Error $
49− proc "docker" ["container", "list", "--format", "{{.Names}}"]
49+ proc "docker" ["container", "list", "--all", "--format", "{{.Names}}"]
5050 pure $ containerName `elem` containerNames
5151 where
5252 needDockerMsg = "This feature requires that you have Docker installed and the `docker` command available on your PATH. Please go https://docs.docker.com/ to install Docker and try this command again."
@@ -69,15 +69,15 @@ setupNixDocker stateDir = withSpinner ("Creating Docker container named " <> con
6969 T.writeFile (stateDir </> "Dockerfile") dockerfile
7070
7171 -- Create new SSH keys for this container
72− callProcessAndLogOutput (Notice, Warning) $
72+ callProcessAndLogOutput (Debug, Error) $
7373 proc "rm" ["-f", stateDir </> sshKeyFileName, stateDir </> sshKeyFileName <.> "pub"]
74− callProcessAndLogOutput (Notice, Warning) $
74+ callProcessAndLogOutput (Debug, Error) $
7575 proc "ssh-keygen" ["-t", "ed25519", "-f", stateDir </> sshKeyFileName, "-P", ""]
7676
7777 -- Build the docker container (which uses the SSH keys in the 'ssh' folder)
78− containerId <- readProcessAndLogStderr Warning $
78+ containerId <- readProcessAndLogStderr Error $
7979 proc "docker" ["build", stateDir, "--quiet"]
80− callProcessAndLogOutput (Notice, Warning) $ proc "docker"
80+ callProcessAndLogOutput (Debug, Error) $ proc "docker"
8181 [ "run"
8282 , "--restart", "always"
8383 , "--detach"