We have a bunch of microservices, published as docker images, and run them on-premise for local testing and in AKS k8s cluster. We use ubuntu 16.04, because currently AKS uses it.
We would like to automatically collect coredump when our microservice crashes inside the docker container. We have successfully achieve it using instructions on local environment, but we would like to use ubuntu apport interceptor to collect CoreDump.
But we unable to collect dump because of the following error:
ERROR: apport (pid 26994) Thu Apr 9 16:17:34 2020: host pid 26979 crashed in a container without apport support
docker run -d --privileged -v /var/crash:/var/crash ubuntu:16.04 /bin/sleep 50000 docker kill <CreatedContainerId>
After looking at what apport is doing it seems that we have to install apport inside the container. Not a problem, create a Dockerfile with apport installation:
FROM ubuntu:16.04 RUN apt-get update && apt-get install -y --no-install-recommends systemd apport && rm -rf /var/lib/apt/lists/* RUN sed -i "s/enabled=0/enabled=1/g" /etc/default/apport RUN sed -i "s/'problem_types'/#'problem_types'/g" /etc/apport/crashdb.conf COPY ./super.sh /opt/super.sh RUN ["chmod", "+x", "/opt/super.sh"] WORKDIR /opt ENTRYPOINT [ "/opt/super.sh" ]
where super.sh is:
#!/bin/bash service apport start sleep 50000
But these also leads to the same result. There must be an
apport.socket entry under host
/proc/<host_pid>/root/run/ directory, which probably tells apport that another instance of it is up and running inside the container.
apport.socket is the activation socket, which will require systemd to be running inside the container.
- Is there a way to enable core dump forwarding for application inside container to host machine using
- What should be done inside container to enable
apportto correctly pass coredump collection?
- Do we really require systemd to be installed inside the docker in order for this to work?
We have achieved behavior we wanted when comment out some code blocks in /usr/share/apport/apport, introduced by
869366238 data/apport (Brian Murray 2017-11-20 08:46:52 -0800)
but this is not the solution we would like to accept.