You can add it to your entrypoint before exec-ing the main command
entrypoint
exec
#!/usr/bin/env bash ulimit -c unlimited echo '/core.%e.%p' > /proc/sys/kernel/core_pattern exec "$@"