# healthcheck-block

> Blocks the execution until the defined container is healthy in a Docker Compose environment.

Latest version **1.1.0** (published 2017-12-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install healthcheck-block
pnpm add healthcheck-block
yarn add healthcheck-block
bun add healthcheck-block
```

Provides the command `healthcheck-block`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2017-12-10 |
| First published | 2017-12-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Kristóf Morva |
| Maintainers | kmorva |

## Links

- npm: https://www.npmjs.com/package/healthcheck-block
- Repository: https://github.com/tutorigo/healthcheck-block
- Homepage: https://github.com/tutorigo/healthcheck-block#readme
- Issues: https://github.com/tutorigo/healthcheck-block/issues
- npm.io page: https://npm.io/package/healthcheck-block

## Recent versions

- 1.1.0 (latest) — 2017-12-10
- 1.0.0 — 2017-12-10

## README

Blocks the execution until the defined container is healthy in a Docker Compose environment. Useful if you have to automatize a script after starting some containers (for example in some CI/CD systems like GitLab).

# Installation
Install it (locally or globally) with `npm`, `yarn`, or any other Node dependency manager:

```
"docker-healthcheck": "*"
```

# Usage
Run it with `node node_moduler/docker-healthcheck network container`, where `network` is the name of the network (project), and `container` is the name of the container (service). For example:

```bash
docker-compose up -d
node node_modules/docker-healthcheck airbnb php
docker-compose -p airbnb exec php composer update
```

As default, we are checking healthiness by executing the healthcheck script (`./docker-healthcheck` as default), so that your script doesn't have to wait for the next cycle of [Docker healthcheck](https://docs.docker.com/engine/reference/builder/#healthcheck) (which is 30 seconds by default). Quite obviously this method does not work, if the healthcheck is defined in the Docker Compose YML file. You can change the script to run with the `-script` parameter, like:

```bash
node node_modules/docker-healthcheck airbnb php -script healthcheck.sh
```

You can also wait for a container to be actually marked healthy by Docker with the `--wait-healthcheck` flag.

If you would like the script to terminate with an error code if the container is still not healthy after a time limit, you can set a timeout in seconds with `-timeout`, for example:

```bash
node node_modules/docker-healthcheck airbnb php -timeout 30
```

---
_Source: https://npm.io/package/healthcheck-block · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
