immauss / openvas

Containers for running the Greenbone Vulnerability Manager. Run as a single container with all services or separate single applications containers via docker-compose.
GNU Affero General Public License v3.0
354 stars 102 forks source link

Unhealty Container #171

Closed noire-x closed 1 year ago

noire-x commented 1 year ago

Hi There, i am having some issues with the container, looks like it is looping on image And on portainer it says unhealty image

Do you have any suggestion? Thanks!

immauss commented 1 year ago

Hmmm ... that seems normal. It is supposed to do a health check every 60 seconds. Is anything not working?

noire-x commented 1 year ago

Oky I just launched a scan. Anyway both docker ps openvas and portainer showing "unhealty"(?). The scan is running anyway and it is at 40% now, will post an update soon ty

noire-x commented 1 year ago

Looks like all working even with unhealty container, ty!

immauss commented 1 year ago

I've been looking at this for a while now, and I can't see why the health check reports no problems on completion, but the container still reports unhealthy. This might take me a while to figure out . . . . .

immauss commented 1 year ago

Good grief...... OK ... so after spending WAY too much time trying to figure out what was wrong with my health check script ....

I went back to the source for HEALTHCHECK. https://docs.docker.com/engine/reference/run/#healthcheck

Where I found this command: docker inspect --format='{{json .State.Health}}' <container-name>

This lead me to the realization that the script was fine, but it was taking more than 3 seconds to complete ... so the HEALTHCHECK was hitting the timeout.

The script took about 5 seconds to run on my machine, so I raised the timeout in the Dockerfile to 10s. This should give more than enough time to complete the checks even on slower hardware. The current latest tag is now operating with this setting and running fine and healthy on my production servers. Thanks for opening this. -Scott