English 中文(简体)
erl_crash during docker build at step mix deps.get
原标题:

Having issue during docker build for Elixir app

└> docker build -t octopus_engine:1.0.0 .
[+] Building 24.2s (12/12) FINISHED                                                              docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                             0.0s
 => => transferring dockerfile: 429B                                                                             0.0s
 => [internal] load metadata for docker.io/library/elixir:1.16-alpine                                            2.6s
 => [auth] library/elixir:pull token for registry-1.docker.io                                                    0.0s
 => [internal] load .dockerignore                                                                                0.0s
 => => transferring context: 2B                                                                                  0.0s
 => [internal] load build context                                                                                0.2s
 => => transferring context: 23.02MB                                                                             0.2s
 => [1/7] FROM docker.io/library/elixir:1.16-alpine@sha256:a048fc41bd57ea566d4a6b985d7fc4529508a3c8cea12a9a10c  16.3s
 => => resolve docker.io/library/elixir:1.16-alpine@sha256:a048fc41bd57ea566d4a6b985d7fc4529508a3c8cea12a9a10c6  0.0s
 => => sha256:a048fc41bd57ea566d4a6b985d7fc4529508a3c8cea12a9a10c6fb0e6f563cc4 7.39kB / 7.39kB                   0.0s
 => => sha256:ffecf4d1038498a3c09a74444f73b15f77694631b3e26027fd23505e424db0aa 1.54kB / 1.54kB                   0.0s
 => => sha256:b79a31843cd6a0c6fd36cce750a676e3b9027b8d158feb12249041b85e905dab 5.50kB / 5.50kB                   0.0s
 => => sha256:bca4290a96390d7a6fc6f2f9929370d06f8dfcacba591c76e3d5c5044e7f420c 3.35MB / 3.35MB                   1.4s
 => => sha256:e5d176ad137694ea02867cbdc69b11fdff3a8aa1e4ac2e369aaad0c36e0a3ea4 45.59MB / 45.59MB                15.7s
 => => sha256:89381e95753af9e4fb0f75d0d6f25329abccb6a68314fe7eda4d894cd0bd1bb4 6.76MB / 6.76MB                   6.8s
 => => extracting sha256:bca4290a96390d7a6fc6f2f9929370d06f8dfcacba591c76e3d5c5044e7f420c                        0.1s
 => => extracting sha256:e5d176ad137694ea02867cbdc69b11fdff3a8aa1e4ac2e369aaad0c36e0a3ea4                        0.5s
 => => extracting sha256:89381e95753af9e4fb0f75d0d6f25329abccb6a68314fe7eda4d894cd0bd1bb4                        0.1s
 => [2/7] ADD . /workspace                                                                                       0.1s
 => [3/7] WORKDIR /workspace                                                                                     0.0s
 => [4/7] RUN rm -rf /workspace/_build                                                                           0.1s
 => [5/7] RUN mix local.hex --force                                                                              1.9s
 => [6/7] RUN mix local.rebar --force                                                                            1.8s
 => ERROR [7/7] RUN mix deps.get                                                                                 1.3s
------
 > [7/7] RUN mix deps.get:
1.052 Resolving Hex dependencies...
1.084 eheap_alloc: Cannot allocate 976733209832459912 bytes of memory (of type "heap_frag").
1.086
1.086 Crash dump is being written to: erl_crash.dump...beam/erl_term.h:1492:tag_val_def() Assertion failed: tag_val_def error
------
Dockerfile:19
--------------------
  17 |     RUN mix local.rebar --force
  18 |
  19 | >>> RUN mix deps.get
  20 |
  21 |     CMD iex --name "octopus@${POD_IP}" --cookie ${ERLANG_COOKIE} -S mix
--------------------
ERROR: failed to solve: process "/bin/sh -c mix deps.get" did not complete successfully: exit code: 139

Cannot export crash dump from build, any info also appreciated.


Dockerfile:

FROM elixir:1.16-alpine

ARG MIX_ENV="dev"
ARG POD_IP="127.0.0.1"
ARG ERLANG_COOKIE="octopus_cookie"

ENV MIX_ENV=${MIX_ENV}
ENV POD_IP=${POD_IP}
ENV ERLANG_COOKIE=${ERLANG_COOKIE}


ADD . /workspace
WORKDIR /workspace
RUN rm -rf /workspace/_build

RUN mix local.hex --force
RUN mix local.rebar --force

RUN mix deps.get

CMD iex --name "octopus@${POD_IP}" --cookie ${ERLANG_COOKIE} -S mix

mix.exs:

defmodule OctopusEngine.MixProject do
  use Mix.Project

  def project do
    [
      app: :octopus_engine,
      version: "1.0.0",
      elixir: "~> 1.16",
      start_permanent: Mix.env() == :prod,
      deps: deps(),
      releases: [
        octopus_engine: [
          include_executables_for: [:unix],
          applications: [runtime_tools: :permanent]
        ]
      ]
    ]
  end

  # Run "mix help compile.app" to learn about applications.
  def application do
    [
      mod: {OctopusEngine.Application, []},
      extra_applications: [:logger]
    ]
  end

  # Run "mix help deps" to learn about dependencies.
  defp deps do
    [
      {:k8s, "~> 2.0"},
      {:libcluster, "~> 3.2"},
      {:credo, "~> 1.7", only: [:dev, :test], runtime: false}
    ]
  end
end

Checked docker-desktop build for logs, but nothing special

logs1

memory limit is 16GB:

logs2

P.S. I m not trying to determine version of Elixir in particular version of Alpine image. Please read my question carefully before calling Close.

My question points to erl_crash which may happen in different versions of OTP in future - which can be useful for others.

问题回答

Solved it by trying lower version of Erlang/OTP via image:

hexpm/elixir:1.16.2-erlang-26.1.2-ubuntu-noble-20240225

I want to send thanks to #benwilson512, #gmorell, #href in Elixir IRC community:

ircs://irc.libera.chat:6697 (instructions) channel: #elixir





相关问题
Unable to connect to docker container inside windows server

As title. I am developing a system with many docker images with ASP.Net MVC core projects. I am publishing these docker images into a docker engine installed on Windows Server OS, and I found that I ...

Only can see postgreSQL as an admin

After installed Wsl and Docker, can t access PSQL and other things. I was studying Docker, and installed the latest version. So far so good, I received an error about the WSL version, saw some ...

make docker-compose block until healthy without `depends_on`

I am working with a team that uses docker-compose to start a set of helper services, but does not use docker when the code is being developed. Here, docker-compose is just a convenient way to run the ...

change grafana port using docker host network

I am trying to spin up a grafana container in docker, however my setup in docker does not allow ipv4 forwarding and thus I cannot use the default bridge network in docker. All I can use is the host ...

Pip instalation for Python 3.11 in docker

I have Dockerfile to build image for Django project that uses Python 3.11 and runs in poetry environment (see content below). Problem is when I try to donwload get-pip.py file and run it using Python, ...

在 Dockerfile 中运行 composer install

我正在尝试将我的Laravel应用程序进行Docker化。 该应用程序已经构建并在Git中,但我将vendor文件夹添加到了.gitignore中。 我添加了一个Dockerfile,看起来像这样: FROM php:7.1-fpm-alpine RUN apk update ...

热门标签