https://github.com/stringbean/docker-healthcheck-action
GitHub Action for checking & waiting for Docker container status
https://github.com/stringbean/docker-healthcheck-action
ci docker github-actions
Last synced: 7 months ago
JSON representation
GitHub Action for checking & waiting for Docker container status
- Host: GitHub
- URL: https://github.com/stringbean/docker-healthcheck-action
- Owner: stringbean
- License: apache-2.0
- Created: 2022-01-13T13:09:43.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-02-06T14:42:09.000Z (about 2 years ago)
- Last Synced: 2025-06-30T17:53:43.039Z (9 months ago)
- Topics: ci, docker, github-actions
- Language: TypeScript
- Homepage:
- Size: 1.05 MB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Docker Container Health Check
GitHub Action for checking the status of a Docker container.
## Usage
### Get the status of a container
To query the status of a container, pass the container name (or id) to the action:
```yaml
jobs:
test:
steps:
- name: Get container status
uses: stringbean/docker-healthcheck-action@v1
id: missing-container
with:
container: unknown
- run: echo "Container is ${{ steps.missing-container.outputs.status }}"
```
This will output "Container is not-running".
### Waiting for a container to become healthy
To wait for a container to become healthy, pass in the required status &
`require-healthy: true`:
```yaml
jobs:
test:
steps:
- name: Start container
run: docker run -d --rm --name hello-world crccheck/hello-world
- name: Wait for container
uses: stringbean/docker-healthcheck-action@v1
with:
container: hello-world
wait-time: 50
require-status: running
require-healthy: true
```
This will start the `hello-world` container and wait for it to pass a health
check. If the container takes longer than 60 seconds to become healthy it will
fail the build.
## Configuration
### Inputs
| Name | Description | Default |
| ----------------- | ------------------------------------------------------------------------------------ | ----------------- |
| `container` | Name of the container to check | _none_ (required) |
| `require-status` | Container status to expect/wait for. | _none_ |
| `require-healthy` | Require (or wait for) the container to be healthy. | `false` |
| `wait-time` | Maximum number of time to wait for the container to reach the required state/health. | `0` (seconds) |
### Outputs
| Name | Description | Examples |
| --------- | --------------------------------- | ---------------------- |
| `status` | Current status of the container. | `not-found`, `running` |
| `healthy` | Whether the container is healthy. | `true`, `false` |