How to get coredump from inside docker container

I would like to collect coredumps from a C++ binary running inside a docker container in GitHub workflows in order to first print a backtrace immediately and second store it as an artifact (together with the binary) to debug later.

I have set:

ulimit -c unlimited

I’ve tried to set the path where core files are written:

/cores/core.%e.%p | /proc/sys/kernel/core_pattern

 but it fails because this is read only.

Similarly, this doesn’t seem to have any effect:

sysctl -w kernel.core_pattern=core

In the default core dump location 


is nothing to be found after a crash.

From reading about this my guess is that the docker container would have to run with


in order to allow changing the path that but supposedly that’s not possible.

@julianoes ,

Maybe you can try using the syntax  jobs.<job_id>.container.options to configure the optiones.

For example:

    name: Test
    runs-on: ubuntu-latest
      image: <image>
      options: --privileged --ulimit core=-1 --security-opt seccomp=unconfined
      - name: Core Dump
        run: |
          ulimit -c unlimited
          echo '/tmp/core.%h.%e.%t' > /proc/sys/kernel/core_pattern
1 Like

Awesome, I tested this and it works. Thank you!