Apache based image exit code 137

Hi,
I have an issue with an apache based image hosted on AWS Elastic Beanstalk (64bit Amazon Linux 2016.03 v2.1.1 running Multi-container Docker 1.9.1), I try to explain as best I can the problem:

sometime apache2 process reach the memory limit and oom killer send SIGKILL to that process, Docker container exit with 137 error code:

“State”: {
“Status”: “exited”,
“Running”: false,
“Paused”: false,
“Restarting”: false,
“OOMKilled”: false,
“Dead”: false,
“Pid”: 0,
“ExitCode”: 137,
“Error”: “”,
“StartedAt”: “2016-08-26T11:42:22.843427982Z”,
“FinishedAt”: “2016-08-26T12:27:47.147464907Z”
},

it seems that the Apache process does not exit and continues to run keeping the container frozed.
In this conditions Elastic Beanstalk try to restart the ECS task but Docker Container do not respond, this cause a freeze of entire environment without being able to do anything except “rebuild environment”, is a really annoying situation.

How can I prevent this? Is a Docker issue or maybe it is the fault of apache?

Hi,
I found this post Googling for the exact same issue. Did you find a solution?

Unfortunately no, my workaround was increase instance type. In this way apache not reach the memory limit but is not a real solution, I hope in a Docker or Apache update that fix this problem.

Hi, thanks for your reply.

The problem is that I’m experiencing the same issue even when I docker stop the container. Once it stops, it doesn’t start again.

My dockerfile ends with:

#Build e avvio Apache
EXPOSE 80
CMD apache2ctl configtest && /usr/sbin/apache2ctl -D FOREGROUND

How do you start your Apache?

If the docker not restart on close maybe you set the wrong essential parameter value in task definition check the documentation.

To run apache in docker is using an other method:

Dockerfile:


ENTRYPOINT [“/entrypoint.sh”]

entrypoint.sh


exec apache2 -D FOREGROUND

Nice try, but I’ve no essential directive. Meanwhile, I was able to isolate the problem: it’s the PHP 5.6 installation. In my dockerfile I’ve:

RUN apt-get update && apt-get install -y php5.6 php5.6-cli

If I remove this one, everything works fine.

I have the same problem with php7.1.

Still researching a solution…