{"action":"created","issue":{"url":"https://api.github.com/repos/docker/docker/issues/11740","labels_url":"https://api.github.com/repos/docker/docker/issues/11740/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/11740/comments","events_url":"https://api.github.com/repos/docker/docker/issues/11740/events","html_url":"https://github.com/docker/docker/issues/11740","id":64217652,"number":11740,"title":"Documentation: Make clear instructions for getting a core file, when container crashes","user":{"login":"dreamcat4","id":63074,"avatar_url":"https://avatars.githubusercontent.com/u/63074?v=3","gravatar_id":"","url":"https://api.github.com/users/dreamcat4","html_url":"https://github.com/dreamcat4","followers_url":"https://api.github.com/users/dreamcat4/followers","following_url":"https://api.github.com/users/dreamcat4/following{/other_user}","gists_url":"https://api.github.com/users/dreamcat4/gists{/gist_id}","starred_url":"https://api.github.com/users/dreamcat4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dreamcat4/subscriptions","organizations_url":"https://api.github.com/users/dreamcat4/orgs","repos_url":"https://api.github.com/users/dreamcat4/repos","events_url":"https://api.github.com/users/dreamcat4/events{/privacy}","received_events_url":"https://api.github.com/users/dreamcat4/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/docker/docker/labels/exp/proficient","name":"exp/proficient","color":"79BD9A"},{"url":"https://api.github.com/repos/docker/docker/labels/kind/writing","name":"kind/writing","color":"A8E6CE"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-03-25T08:51:22Z","updated_at":"2015-03-25T12:02:37Z","closed_at":null,"body":"Hello,\r\nI've been struggling with this on ubuntu 14.10, docker 1.5.0. More than should be the case.\r\n\r\nMy problems came from the following:\r\n\r\n* Assuming that the ulimit is set the same inside a container than on the host. (it isn't). But also, that the output of the ulimit command was a bit misleading because:\r\n\r\n```sh\r\n$ ulimit\r\nunlimited\r\n```\r\n\r\nis not the same thing as \r\n\r\n```sh\r\n$ ulimit -c\r\n0\r\n```\r\n\r\nIn the container, base image was `ubuntu-debootstrap:14.04`.\r\n\r\n* On ubuntu the default setting - core files get piped to `apport` program. This is no good in containers. It must be overridden to something else if `apport` is not installed inside the container.\r\n\r\nIt would also be a help if linux kernel could have a different value of `/proc/sys/kern/pattern` inside the container than outside it. Since in the 2 environments they may need to point to different locations. I'm not sure that is something that Docker can do anything about but might be worth to think about.\r\n\r\n* It is not clear, as core dumps are a kernel managed thing, whether resulting core files are written by kernel to the host filesystem or the container filesystem. This should also be clearly documented. They are written inside the container.\r\n\r\n* Open question: How best to save the core files as when the container exits the filesystem is not remembered. I think docker could give a clear instruction here too - e.g. how or what to mount where to write the core files to.\r\n\r\nMany thanks for any consideration. Else it will have to be answered on stack overflow.\r\n"},"comment":{"url":"https://api.github.com/repos/docker/docker/issues/comments/85999350","html_url":"https://github.com/docker/docker/issues/11740#issuecomment-85999350","issue_url":"https://api.github.com/repos/docker/docker/issues/11740","id":85999350,"user":{"login":"dreamcat4","id":63074,"avatar_url":"https://avatars.githubusercontent.com/u/63074?v=3","gravatar_id":"","url":"https://api.github.com/users/dreamcat4","html_url":"https://github.com/dreamcat4","followers_url":"https://api.github.com/users/dreamcat4/followers","following_url":"https://api.github.com/users/dreamcat4/following{/other_user}","gists_url":"https://api.github.com/users/dreamcat4/gists{/gist_id}","starred_url":"https://api.github.com/users/dreamcat4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dreamcat4/subscriptions","organizations_url":"https://api.github.com/users/dreamcat4/orgs","repos_url":"https://api.github.com/users/dreamcat4/repos","events_url":"https://api.github.com/users/dreamcat4/events{/privacy}","received_events_url":"https://api.github.com/users/dreamcat4/received_events","type":"User","site_admin":false},"created_at":"2015-03-25T12:02:37Z","updated_at":"2015-03-25T12:02:37Z","body":"*...and another super-important-detail that everybody should be made aware of regarding core dumps**\r\n\r\n* If you are using an `ubuntu` base image. And most likely any other popular one, such as `busybox` or `debian` too.\r\n\r\n* Then if you make your launch script's shebang line `#!/bin/sh` - that is the `dash` shell.\r\n\r\nWell hey! Guess what? The `ulimit -c <new value>` command will not change the value in your container. It can read the value from the dash shell. But not write to it. That only works from being inside of `bash`. \r\n\r\nLike this:\r\n\r\n```sh\r\n#!/bin/sh\r\n\r\nulimit -c unlimited\r\n```\r\n\r\nSo again, no core dumps for you my friend! No core file will be generated. And when it fails to set the value, `dash` shell returns a `0` successful return code. A missing functionality in the dash shell. Despite being POSIX compliant and so we might discover that `ulimit -c unlimited` is not a part of the POSIX.2 spec.\r\n\r\n^^ That is far too easy to get wrong and IMHO needs to be documented also."}}