I have weird issue now with mix local.rebar --force
timing out semi-randomly when I run it from within docker container.
I am attaching a Dockerfile recipe below, that fails to build on the last RUN
FROM buildpack-deps:stretch
USER root
ENV LANG=C.UTF-8
ENV HOME=/root
RUN apt-get update && apt-get install -y --no-install-recommends apt-utils
#
# ERLANG
#
ENV ERLANG_VERSION="1:23.2.3-1"
RUN wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb && dpkg -i erlang-solutions_1.0_all.deb
RUN apt-get update && \
apt-get install -yy --no-install-recommends esl-erlang=${ERLANG_VERSION}
#
# ELIXIR
#
ENV ELIXIR_VERSION="v1.11.3"
RUN set -xe \
&& ELIXIR_DOWNLOAD_URL="https://github.com/elixir-lang/elixir/releases/download/${ELIXIR_VERSION}/Precompiled.zip" \
&& buildDeps=' \
unzip \
' \
&& apt-get update \
&& apt-get install -y --no-install-recommends $buildDeps \
&& curl -fSL -o elixir-precompiled.zip $ELIXIR_DOWNLOAD_URL \
&& unzip -d /usr/local elixir-precompiled.zip \
&& rm elixir-precompiled.zip
#
# Hex + Rebar
#
ENV MIX_ENV=prod
RUN mix local.hex --force
RUN mix local.rebar --force
This last step times out when building the dockedr image. I can also reproduce the same issue by running docker run ... mix local.rebar --force
. Every 5 or 6 runs this fails with timeout:
** (Mix) request timed out after 60000ms
Could not install Rebar because Mix could not download metadata at https://repo.hex.pm/installs/rebar3-1.x.csv.
or
** (Mix) request timed out after 60000ms
Could not fetch rebar at:
https://repo.hex.pm/installs/1.0.0/rebar-2.6.2
Please download the file above manually to your current directory and run:
mix local.rebar rebar ./rebar
When I run mix local.rebar --force
on the host machine I have no such issue no matter how many times I run it.
There are obvious differences in the set up: my dev machine is Ubuntu 20.4, and Docker image is Debian stretch. Again, I can’t reproduce it on my dev machine’s host OS.
When the above sometimes succeeds in Docker image, then I get errors when installing deps:
$ mix deps.get
Failed to fetch record for 'hexpm/timex' from registry (using cache instead)00:16
** (Mix) Unknown package timex in lockfile
Again, from CI / Docker image only. Not from host machine, that works fine.
So… any ideas anyone what can cause the Docker image to have these connectivity issues? This is happening both on CI and on my dev machine when I run the image.