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

New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: The documentation above suggests that while ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

Other popular topics Top

aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 52673 488
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement