1

I am developing an Erlang-OTP application, for that I use a docker image.

docker-compose.yml:

FROM centos
LABEL Name=myimage Version=2.0.0

RUN set -e \
   && yum -y install \
      autoconf \
      gcc \
      gcc-c++ \
      git \
      glibc-devel \
      make \
      ncurses-devel \
      tar \
      curl


ENV SSL_VERSION="1.0.2p"

RUN set -e \
   && mkdir -p /tmp/openssl \
   && cd /tmp \
   && curl -fSL -o openssl.sha256   http://www.openssl.org/source/openssl-${SSL_VERSION}.tar.gz.sha256 \
   && curl -fSL -o openssl.tar.gz http://www.openssl.org/source/openssl-${SSL_VERSION}.tar.gz \
   && SHA=$(printf "%s  openssl.tar.gz" `cat openssl.sha256` | sha256sum -c -); if [ "openssl.tar.gz: OK" != "${SHA}" ]; then exit 3; fi \
   && tar -zxf openssl.tar.gz -C /tmp/openssl --strip-components=1 \
   && cd /tmp/openssl \
   && ./Configure \
         --prefix=/usr/local/ssl \
         --openssldir=/usr/local/ssl \
      linux-x86_64 \
      shared \
   && make -j4 \
   && make install \
   && rm -Rf /tmp/openssl*

ENV OTP_VERSION="20.3.6"
ENV WITH_NATIVE=true

RUN set -e \
   && mkdir -p /tmp/otp_src \
   && cd /tmp \
   && curl --tlsv1.2 -fSL -o otp_src.tar.gz https://github.com/erlang/otp/archive/OTP-20.3.6.tar.gz \
   && tar -zxf otp_src.tar.gz -C /tmp/otp_src --strip-components=1 \
   && cd /tmp/otp_src \
   && ./otp_build autoconf \
   && ./configure \
         --prefix=/usr/local/otp \
         --enable-threads \
         --enable-smp-support \
         --enable-kernel-poll \
         --disable-dynamic-ssl-lib \
         --with-ssl=/usr/local/ssl \
         `test "${WITH_NATIVE}" = "true" && echo "--enable-hipe --enable-native-libs"` \
   && make -j4 \
   && make install \
   && ln -s /usr/local/otp_${OTP_VERSION} /usr/local/otp \
   && rm -Rf /tmp/otp_src*

ENV PATH $PATH:/usr/local/otp/bin

RUN set -e \
   && yum -y install \
      which


ENV REBAR3_VERSION="3.6.1"

RUN set -xe \
    && REBAR3_DOWNLOAD_URL="https://github.com/erlang/rebar3/archive/${REBAR3_VERSION}.tar.gz" \
    && REBAR3_DOWNLOAD_SHA256="40b3c85440f3235c7b149578d0211bdf57d1c66390f888bb771704f8abc71033" \
    && mkdir -p /usr/src/rebar3-src \
    && curl --tlsv1.2 -fSL -o rebar3-src.tar.gz "$REBAR3_DOWNLOAD_URL" \
    && echo "$REBAR3_DOWNLOAD_SHA256 rebar3-src.tar.gz" | sha256sum -c - \
    && tar -xzf rebar3-src.tar.gz -C /usr/src/rebar3-src --strip-components=1 \
    && rm rebar3-src.tar.gz \
    && cd /usr/src/rebar3-src \
    && HOME=$PWD ./bootstrap \
    && install -v ./rebar3 /usr/local/bin/ \
    && rm -rf /usr/src/rebar3-src

RUN mkdir /myimage
WORKDIR /myimage

Commands to run docker-compose

sudo docker-compose build
sudo docker-compose run --rm myimage bash

When I try to run production tar created by Ubuntu-18.04, I get:

error while loading shared libraries: libtinfo.so.6: cannot open shared object file: No such file or directory.

I dont get any error while compiling. When I create this tar from Debian-9, it runs without error.

Debian machine has locally installed erlang-otp, but Ubuntu doesnt have.

1 Answer 1

1

There is Docker's known issue #37531

To fix dependencies, you might try:

  1. Either upgrade Docker to 17.02
curl -sSL https://get.docker.com/ | sudo bash
  1. or install lib inside of container. Since your container based on Centos (FROM centos), so try yum install
rpm -ql libXtst-devel-1.2.2-2.1.el6.x86_64
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.