Skip to content

Commit

Permalink
New docker-log-level
Browse files Browse the repository at this point in the history
  • Loading branch information
metaskills committed Jan 21, 2023
1 parent 0513345 commit 65a9f82
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/docker-log-level/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

# Set Docker Log Level (docker-log-level)

Sets the docker log-level (https://docs.docker.com/config/daemon/logs/) to warn by creating a `/etc/docker/daemon.json` file.

## Example Usage

```json
"features": {
"ghcr.io/customink/codespaces-features/docker-log-level": {}
}
```

## Options

| Options Id | Description | Type | Default Value |
|------------|------------------------------|--------|---------------|
| level | Select the Docker log-level. | string | warn |
15 changes: 15 additions & 0 deletions src/docker-log-level/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"id": "docker-log-level",
"name": "Set Docker Log Level",
"version": "1.0.0",
"description": "Creates a daemon.json with log-level",
"documentationURL": "https://github.com/customink/codespaces-features/tree/main/src/docker-log-level",
"options": {
"level": {
"type": "string",
"description": "Select the Docker log-level.",
"enum": ["debug", "info", "warn", "error", "fatal"],
"default": "warn"
}
}
}
13 changes: 13 additions & 0 deletions src/docker-log-level/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh
set -e

echo "== [Custom Ink] installing 'docker-log-level' features ... =="

if [ ! "${CODESPACES}" = "true" ]; then
echo "== [Custom Ink] detected CODESPACES=true =="
sudo mkdir -p /etc/docker
echo '{ "log-level": "warn" }' | sudo tee /etc/docker/daemon.json
else
echo "== [Custom Ink] CODESPACES not detected in env. =="
env
fi

0 comments on commit 65a9f82

Please sign in to comment.