haskell / docker-haskell

MIT License
63 stars 37 forks source link

Docker example fails to run #27

Closed benjamingoldstein closed 3 years ago

benjamingoldstein commented 4 years ago

Hi everyone.

I just ran this example successfully:

docker run -it --rm haskell:8

However the second example does not work. Here is the Dockerfile:

FROM haskell:8
RUN stack install pandoc pandoc-citeproc
ENTRYPOINT ["pandoc"]

When I run docker build . I get this error:

$ docker build .
Sending build context to Docker daemon  2.048kB
Step 1/3 : FROM haskell:8
 ---> 77fd2cbd6f87
Step 2/3 : RUN stack install pandoc pandoc-citeproc
 ---> Running in 90bd308cea32
Writing implicit global project config file to: /root/.stack/global-project/stack.yaml
Note: You can change the snapshot via the resolver field there.
Using latest snapshot resolver: lts-16.16
No compiler found, expected minor version match with ghc-8.8.4 (x86_64-tinfo6) (based on resolver setting in /root/.stack/global-project/stack.yaml).
To install the correct GHC into /root/.stack/programs/x86_64-linux/, try running "stack setup" or use the "--install-ghc" flag. To use your system GHC installation, run "stack config set system-ghc --global true", or use the "--system-ghc" flag.
The command '/bin/sh -c stack install pandoc pandoc-citeproc' returned a non-zero code: 1

I have tried several times with --system-ghc, but same error.

I've found a similar error on a Japanese stackoverflow question, but I could not follow the translated answer.

https://translate.googleusercontent.com/translate_c?depth=1&hl=en&prev=search&pto=aue&rurl=translate.google.com&sl=ja&sp=nmt4&u=https://ja.stackoverflow.com/questions/70001/no-compiler-found-expected-minor-version-match-with-ghc-8-8-4&usg=ALkJrhhFLe0WPLvjIFnYcS4vbT-87-dqjQ

I am trying to compile my stack project into a binary so I can copy it onto a server.

Thanks Ben

AlistairB commented 3 years ago

Hi,

I believe the problem is that you are pulling in haskell:8 which means, give me the latest haskell 8.* version.

At the time you ran this, the latest stackage was on ghc 8.8, however, presumably the docker image you loaded was 8.10 thus the version mismatch. Stack inside the haskell docker image is configured to only use pre-install ghc versions so it won't install a missing ghc version for you.

The solution is to be more specific in terms of when haskell image you use. Specifying haskell:8.8 would give you the exact version you want. Although now, latest stackage is on 8.10 so you probably want to use haskell:8.10.

I'm going to close this as doesn't seem to be an issue with the haskell images. Feel free to comment or reopen (if you can?) if you think there is still a problem.

Cheers

AlistairB commented 3 years ago

Sorry I just realised this is directly from the 'How to use' section on docker hub. This should be updated..

AlistairB commented 3 years ago

Should be fixed.