title: Why doesn't my Haskell program run in Docker with Alpine or Scratch?
body: <p>I'm having a few issues try to build a Docker container that runs one Haskell application indefinitely. For starters, I'd like to use a base image that provides a program I need to use from my code. It is based on scratch linux. However, when I build my Haskell program and copy it to that container, I get an error:</p>
  
  <blockquote>
    <p>standard_init_linux.go:211: exec user process caused "no such file or
    directory"</p>
  </blockquote>
  
  <p>Next, I would like to keep my build process, and file structure very simple if possible. I have just one script in Haskell in Main.hs and it has one dependency on process. If it's possible and reasonable to avoid both a stack and a cabal file as well as subdirectories and all the that, it'd be nice if the build directive where just in the Docker or in the Haskell file.</p>
  
  <p>However I have an issue with the build in that the stack ghc line takes several minutes to download ghc and process and build everything and that line reexecutes whenever I make a small code change. This makes development very difficult.</p>
  
  <p>What's a better process for running a simple Haskell script in a Docker image?</p>
  
  <p>Here is my simplified Docker image:</p>
  
  <pre><code># Pretty standard just using the latest stack-build
  FROM fpco/stack-build:lts-15.4 as haskell
  # Setup a build dir and copy code to it
  WORKDIR /opt/build
  COPY Main.hs /opt/build
  # This step takes forever and reruns every time I make a code change.
  RUN stack ghc --package process -- Main.hs
  
  # Alpine failed here for file not found.
  FROM ubuntu:latest
  COPY --from=haskell /opt/build/Main /Main
  ENTRYPOINT ["/Main"]
  </code></pre>
  
  <p>A simplified version of the Haskell program.</p>
  
  <pre><code>import System.Process (readProcess)
  import Control.Monad (forever)
  main = forever $ do
      output &lt;- readProcess "/bin/ls" [] ""
      print output
  </code></pre>