title: Can docker solve a problem of mismatched C shared libraries?
body: <p>I am trying to run some haskell code on an ubuntu (18.04) host, which was compiled on my laptop.</p>
  
  <pre><code>host: 4.15.0-36-generic #39-Ubuntu SMP Mon Sep 24 16:19:09 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
  
  laptop: 4.14.74-1-MANJARO #1 SMP PREEMPT Fri Oct 5 14:16:52 UTC 2018 x86_64 GNU/Linux
  </code></pre>
  
  <p>The error I get is</p>
  
  <pre><code>/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found
  </code></pre>
  
  <p>After doing some research I learned that this is because my laptop has version 2.28 of glibc installed, but the host only has libc6 2.27.</p>
  
  <p>I did some googling and figured that maybe docker could solve this problem. However, I just created a docker image with the following Dockerfile and it didn't work (same GLIBC_2.28 error)</p>
  
  <pre><code>FROM fpco/stack-build:lts-12.9 as builder
  
  RUN mkdir /opt/build
  COPY . /opt/build
  RUN cd /opt/build &amp;&amp; stack build 
  
  FROM ubuntu:18.04
  RUN mkdir -p /opt/myapp
  WORKDIR /opt/myapp
  RUN apt-get update &amp;&amp; apt-get install -y \
    ca-certificates
  COPY --from=builder /opt/build/.stack-work/install/x86_64-linux-tinfo6/lts-12.9/8.4.3/bin .
  CMD ["/opt/myapp/myapp-exe"]
  </code></pre>
  
  <p>I'm not sure what to do now. I have a few questions:</p>
  
  <ul>
  <li><p>Why am I getting this problem in the first place? I thought I read somewhere that glibc is backwards compatible? (Is glibc the same thing as libc6..?)</p></li>
  <li><p>Is there a way to use docker to get around this problem? Could i run my build process inside an ubuntu image? e.g. <code>FROM fcpo/stack-build:lts-12.9 and ubutu:18.04</code>, then later on creating another ubuntu image into which i copy my binary?</p></li>
  <li><p>Has anybody else run into this before ? If so did you find a solution (other than just changing operating system?)?</p></li>
  </ul>