This commit is contained in:
@@ -9,6 +9,7 @@ A Docker container that monitors the Puppeteer API and automatically restarts th
|
||||
- Configurable via environment variables
|
||||
- Comprehensive logging
|
||||
- Docker socket access for container management
|
||||
- Proper Docker permissions handling
|
||||
|
||||
## Environment Variables
|
||||
|
||||
@@ -28,6 +29,7 @@ A Docker container that monitors the Puppeteer API and automatically restarts th
|
||||
docker run -d \
|
||||
--name puppeteer-healthcheck \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
--group-add $(getent group docker | cut -d: -f3) \
|
||||
-e BASE_URL="https://puppeteer.workwithkora.com" \
|
||||
-e TEST_URL="https://www.google.com" \
|
||||
-e API_KEY="your-api-key" \
|
||||
@@ -47,6 +49,8 @@ services:
|
||||
container_name: puppeteer-healthcheck
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
group_add:
|
||||
- docker
|
||||
environment:
|
||||
- BASE_URL=https://puppeteer.workwithkora.com
|
||||
- TEST_URL=https://www.google.com
|
||||
@@ -79,21 +83,38 @@ The container logs all health check activities to both stdout and a log file (`/
|
||||
|
||||
- The container requires access to the Docker socket to restart other containers
|
||||
- Ensure proper API key management
|
||||
- Consider running with limited privileges where possible
|
||||
- The container runs as a non-root user for security
|
||||
- The container runs as a non-root user in the docker group for security
|
||||
- Use `--group-add` or `group_add` to add the container to the docker group
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Docker Permission Issues
|
||||
|
||||
If you see "Permission denied" errors when accessing the Docker socket:
|
||||
|
||||
1. **For Docker Run**: Add the `--group-add` flag:
|
||||
|
||||
```bash
|
||||
--group-add $(getent group docker | cut -d: -f3)
|
||||
```
|
||||
|
||||
2. **For Docker Compose**: Add the `group_add` section:
|
||||
|
||||
```yaml
|
||||
group_add:
|
||||
- docker
|
||||
```
|
||||
|
||||
3. **Alternative**: Run the container as root (not recommended for production):
|
||||
```bash
|
||||
docker run --user root ...
|
||||
```
|
||||
|
||||
### Container not found
|
||||
|
||||
- Ensure the `TARGET_CONTAINER` environment variable matches the exact name of your puppeteer-api container
|
||||
- Verify the container is running and accessible
|
||||
|
||||
### Permission denied
|
||||
|
||||
- Ensure the Docker socket is properly mounted
|
||||
- Check that the container has the necessary permissions to access the Docker daemon
|
||||
|
||||
### API key issues
|
||||
|
||||
- Verify the API key is correct and has the necessary permissions
|
||||
@@ -107,4 +128,4 @@ docker build -t puppeteer-healthcheck .
|
||||
|
||||
## Version
|
||||
|
||||
Current version: 1.0.0
|
||||
Current version: 1.0.1
|
||||
|
||||
Reference in New Issue
Block a user