Error with mix deps.get in docker build

Hi Folks,

I am trying to setup docker to build releases using distillery and I can’t get past this error with mix reps.get–How can I get more info to try to diagnose this issue? Does anyone have any clue what is going wrong?


Step 52/52 : RUN mix deps.get
 ---> Running in 28244739bfc4
Running dependency resolution...
Dependency resolution completed:
  certifi 1.0.0
  coherence 0.3.1
  combine 0.9.6
  comeonin 2.6.0
  connection 1.0.4
  cowboy 1.1.2
  cowlib 1.0.2
  db_connection 1.1.2
  decimal 1.3.1
  distillery 1.3.5
  ecto 2.1.4
  fs 0.9.2
  gettext 0.13.1
  hackney 1.7.1
  idna 4.0.0
  metrics 1.0.1
  mime 1.1.0
  mimerl 1.0.2
  phoenix 1.2.3
  phoenix_ecto 3.2.3
  phoenix_html 2.9.3
  phoenix_live_reload 1.0.8
  phoenix_pubsub 1.0.1
  phoenix_swoosh 0.1.3
  phoenix_timex 1.0.1
  plug 1.3.4
  poison 2.2.0
  poolboy 1.5.1
  postgrex 0.13.2
  ranch 1.3.2
  ssl_verify_fun 1.1.1
  swoosh 0.7.0
  timex 2.2.1
  timex_ecto 1.1.3
  tzdata 0.5.12
  uuid 1.1.7
* Getting phoenix (Hex package)
  Checking package (
  Fetched package
** (exit) an exception was raised:
    ** (MatchError) no match of right hand side value: {:error, :enoent}
        (stdlib) erl_tar.erl:870: :erl_tar.write_file/2
        (stdlib) erl_tar.erl:810: :erl_tar.write_extracted_element/3
        (stdlib) erl_tar.erl:598: :erl_tar.extract1/4
        (stdlib) erl_tar.erl:571: :erl_tar.foldl_read1/4
        (stdlib) erl_tar.erl:554: :erl_tar.foldl_read0/4
        (stdlib) erl_tar.erl:546: :erl_tar.foldl_read/4
        (hex) lib/hex/tar.ex:94: Hex.Tar.extract_contents/3
        (hex) lib/hex/tar.ex:43: Hex.Tar.unpack/5
    (stdlib) erl_tar.erl:556: :erl_tar.foldl_read0/4
    (stdlib) erl_tar.erl:546: :erl_tar.foldl_read/4
    (hex) lib/hex/tar.ex:94: Hex.Tar.extract_contents/3
    (hex) lib/hex/tar.ex:43: Hex.Tar.unpack/5
    (hex) lib/hex/scm.ex:117: Hex.SCM.checkout/1
    (mix) lib/mix/dep/fetcher.ex:64: Mix.Dep.Fetcher.do_fetch/3
    (mix) lib/mix/dep/converger.ex:177: Mix.Dep.Converger.all/9
    (mix) lib/mix/dep/converger.ex:116: Mix.Dep.Converger.all/7

The command '/bin/sh -c mix deps.get' returned a non-zero code: 1

It looks like it can’t write to the docker file system.

Is this for a developers workstation, or is this something you’re going to deploy?

If it’s for deployment then I would do this deps.get outside of the docker container and then copy the results into the /app directory.

You have to remember that each step you do inside a docker build is going to create a new layer. Each new layer adds size to the docker image, and you’d like to keep that as small as possible.

I’m trying to setup a docker container that I will use to build releases with distillery. I’m not a docker expert so I may not be doing this right. I am planning to then use ansible to actually deploy the release to a VPS, but I have not been able to get past the step of building the docker image.
If anyone has suggestions about how I should be doing this differently, please let me know.

Ah, I haven’t done this yet, but I think you may have to setup a local mount for the docker image to write to.

Thanks, jeramyRR for the clue–It turned out that I had not set the WORKDIR in my Dockerfile so it was trying to use / and that location was not writeable. As soon as I set the WORKDIR to a writeable directory (e.g. WORKDIR /home/developer/elixir in my case) everything worked.

What would be the recommended way to get better debugging info so I might have identified the issue of not having write permissions myself–the error “(MatchError) no match of right hand side value:” did not make that obvious to me.

1 Like

This line was your clue:

Unfortunately Erlang error logs aren't direct in the underlying problems. They give you just enough context to figure it out, but not enough to instantly know what the solution should be.