docker如何產(chǎn)生core文件?
docker容器內(nèi)應(yīng)用服務(wù)生成core文件步驟:
1、設(shè)置core文件生成格式和輸出路徑
物理機(jī)上執(zhí)行如下命令:
echo "/data/cores/core.%p" | sudo tee /proc/sys/kernel/core_pattern
2、docker容器掛在core文件路徑到物理機(jī)對(duì)應(yīng)路徑。
for example: docker run -it -d /tmp/core:/data/cores test:v1.0 /bin/bash
3、容器內(nèi)執(zhí)行ulimit -c umlimited
4、容器內(nèi)模擬產(chǎn)生core文件
kill -s SIGSEGV $$
執(zhí)行該命令后,在主機(jī)/tmp/core
下會(huì)產(chǎn)生一個(gè)core文件