diff --git a/src/docker-log-level/README.md b/src/docker-log-level/README.md new file mode 100644 index 0000000..94ed60b --- /dev/null +++ b/src/docker-log-level/README.md @@ -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 | diff --git a/src/docker-log-level/devcontainer-feature.json b/src/docker-log-level/devcontainer-feature.json new file mode 100644 index 0000000..36f6218 --- /dev/null +++ b/src/docker-log-level/devcontainer-feature.json @@ -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" + } + } +} diff --git a/src/docker-log-level/install.sh b/src/docker-log-level/install.sh new file mode 100755 index 0000000..678412e --- /dev/null +++ b/src/docker-log-level/install.sh @@ -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