hubertlepicki

hubertlepicki

Installing rebar from hex.pm times out randomly when ran from within Docker container

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.

Most Liked

ericmj

ericmj

Elixir Core Team

We have one now: https://status.hex.pm/.

ericmj

ericmj

Elixir Core Team

We are aware of the issue and working with Fastly and Semaphore CI who are working with their upstream providers to resolve the issue.

As a disclaimer to the suggested workaround of using a mirror is that we cannot vouch for our guarantee the security of a non-official mirror when authenticating against the repository or when using private packages. Using a mirror is at your own risk.

Where Next?

Popular in Questions Top

srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
sacepums
Hey guys. I'm new to elixir and im really stocked about it. But I ran into a bit of problem - I need to convert a date sting, for examp...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New

Other popular topics Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
AstonJ
by Lance Halvorsen Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
460 27162 124
New

We're in Beta

About us Mission Statement