vagrant@vagrant-ubuntu-trusty-64:~/Desktop$ cat > hello.hs <<EOF
main :: IO ()
main = putStrLn "Static Hello"
EOF
vagrant@vagrant-ubuntu-trusty-64:~/Desktop$ ghc -optl-static -optl-pthread hello.hs -static
[1 of 1] Compiling Main ( hello.hs, hello.o )
Linking hello ...
/opt/ghc/7.8.4/lib/ghc-7.8.4/rts-1.0/libHSrts.a(Linker.o): In function `internal_dlopen':
(.text+0x5c): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
vagrant@vagrant-ubuntu-trusty-64:~/Desktop$ ./hello
Static Hello
vagrant@vagrant-ubuntu-trusty-64:~/Desktop$ docker run --rm -v $(pwd)/hello:/usr/local/bin/hello:ro ubuntu:14.04 /usr/local/bin/hello
Static Hello
vagrant@vagrant-ubuntu-trusty-64:~/Desktop$ docker run --rm -v $(pwd)/hello:/usr/local/bin/hello:ro busybox /usr/local/bin/hello
hello: out of memory (requested 1048576 bytes)
vagrant@vagrant-ubuntu-trusty-64:~/Desktop$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.8.4