I am trying to create docker image with the Haskell application inside. however, the domain name resolution of hostnames of other containers in the network in my application inside docker container fails (but I am able to wget
/ ping
other containers and their hostnames are correctly resolved).
To find the root cause I tried to resolve manually hostnames (using Network.DNS
package) and use only IP addresses in servant-client
. However this yields just cryptic error message:
Network.BSD.getProtocolByName: does not exist (no such protocol name: udp)
I think I am missing some packages inside my docker image. I've tried installing libc6-compat
but without success (libc6
from Debian was used to compile Haskell application). Moreover /etc/protocols
contains correct entries. What else is missing inside a docker image?
The docker image I am using to run the application is alpine:3.6
- Whole dockerfile, there's not much in it. This is different image than used to build the application (It is ~20x smaller).
The docker image I am using to build the haskell app is based on debian:stretch
. Dockerfile.
Whole source code with the build instructions is available here (Angular part can be skipped):
https://github.com/carbolymer/blockchain/tree/0b041875f71b2a09dc8568ee7b0cc22460fd5624
I couldn't manage to install GHC 8.2.1 on alpine + musl libc. As a workaround I tried to use alpine-glibc image, but it resulted in the segfaults whenever my application tried to resolve host names. It turns out, that this is known bug in glibc.
The solution is to use dynamically linked binary + alpine-glibc image + install gmp-dev
additionally.