Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: HEALTHCHECK in Dockerfile #242

Open
wants to merge 1 commit into
base: release/v0.7.0
Choose a base branch
from

Conversation

CremaLuca
Copy link
Contributor

In commit 9a36187 the /api/healthz was added to resolve issue #226; I used this feature to use the Docker health check functionality.

There should be two ways to do it:

  1. Add --health-cmd to docker run or healthcheck to docker-compose file
  2. Add it to the Dockerfile so it is enabled by default

I went for the second option as you can change the details of the healtz endpoint without having to change every user's configuration.

I set the timeout, start-period and interval arbitrarily, can be changed as you like.

Example

The healthcheck works even if external port is changed, I tested mine with port 8045.

As the container is starting the status is "starting"

IMAGE                              COMMAND                  CREATED         STATUS                             PORTS                                                     
cremaluca/glance:0.0.1             "/app/glance"            4 seconds ago   Up 3 seconds (health: starting)    0.0.0.0:8045->8080/tcp, [::]:8045->8080/tcp

But after a few seconds it has already changed to healthy

IMAGE                              COMMAND                  CREATED         STATUS                            PORTS                                                        
cremaluca/glance:0.0.1             "/app/glance"            9 seconds ago   Up 8 seconds (healthy)            0.0.0.0:8045->8080/tcp, [::]:8045->8080/tcp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant