Retrieving erl_crash.dump from crashed docker container

I have an application running in a Docker container in AWS ECS. We have been running into situations here and there that cause our image to crash. the last thing it says before it dies is: Crash dump is being written to: erl_crash.dump...done.

Unfortunately, once the application crashes, we no longer have access to the container to retrieve the erl_crash.dump file, so we have never had a chance to inspect it.

Is there any way to retrieve this file, or send the file somewhere on the way out?

Thanks!

1 Like

You could change your docker cmd to run a bash script that starts the app and monitors abnormal exits, then stores the crash dump in a bucket as a final step.

You can set the environment variable ERL_CRASH_DUMP to a path. That way, you could write to a volume or network drive.

https://www.erlang.org/doc/apps/erts/crash_dump.html

5 Likes

Thanks guys!

Putting this together now.

Hi @sergio_101
What did you end up doing. Setting ERL_CRASH_DUMP path?

I just found myself in the same situation and needed the crash.dump.
There’s a way to extract a file from an exited container using docker cp:

docker cp id_of_exited_container:/app/bin/erl_crash.dump restored_dump

Hope this helps.

2 Likes