# Goss — Quick and Easy Server Validation and Testing > A YAML-based server testing tool that validates system state — packages, services, files, ports, and more — in seconds. Commonly used for infrastructure testing, health checks, and container validation in CI/CD pipelines. ## Install Save in your project root: # Goss — Quick and Easy Server Validation and Testing ## Quick Use ```bash # Install curl -fsSL https://goss.rocks/install | sh # Auto-generate tests from current system state goss autoadd nginx # Run validation goss validate # Serve as health endpoint goss serve & curl http://localhost:8080/healthz ``` ## Introduction Goss is a server validation tool that lets you write infrastructure tests in simple YAML and execute them in milliseconds. Instead of writing complex test scripts, you declare the expected state of packages, services, files, ports, and processes, and Goss verifies them instantly. It is particularly useful for validating Docker images and running health checks in production. ## What Goss Does - Validates system state: packages installed, services running, ports listening, files existing with correct permissions - Auto-generates test specs from the current system state using ``goss autoadd`` - Runs all validations in parallel, completing in under a second on most systems - Serves a health check HTTP endpoint (``goss serve``) for use with load balancers and orchestrators - Outputs results in TAP, JSON, JUnit, Nagios, and human-readable formats ## Architecture Overview Goss is a single static Go binary with no external dependencies. It reads a YAML file (goss.yaml) containing resource declarations — package, service, file, port, process, command, http, dns, and more. At runtime, it queries the host OS for each declared resource and compares actual state against expected state. All checks run concurrently using Go goroutines. The ``goss serve`` mode wraps validation behind an HTTP endpoint that returns pass/fail with details. ## Self-Hosting & Configuration - Install via the official install script or download the binary from GitHub releases - Use ``goss autoadd `` to generate YAML from existing system state - Edit goss.yaml to add or refine assertions (e.g., file content matches, service enabled) - Integrate into CI/CD by running ``goss validate`` as a build step - Use dgoss wrapper for Docker container validation during image builds ## Key Features - Sub-second execution for hundreds of system checks - Zero dependencies — single static binary runs anywhere - dgoss wrapper for validating Docker containers during builds - Built-in HTTP health endpoint for Kubernetes liveness and readiness probes - Supports gossfile includes for organizing large test suites ## Comparison with Similar Tools - **InSpec** — Ruby-based compliance framework with richer policy language; Goss is faster and simpler with YAML-only config - **Serverspec** — Ruby/RSpec-based; Goss requires no Ruby runtime and runs significantly faster - **Testinfra** — Python-based; Goss trades programmatic flexibility for speed and simplicity - **Ansible assert** — Embedded in playbooks; Goss runs standalone and is purpose-built for validation ## FAQ **Q: Can Goss validate Docker containers?** A: Yes. The dgoss wrapper starts a container, copies Goss and the test file inside, runs validation, and reports results — all in one command. **Q: How fast is Goss compared to InSpec or Serverspec?** A: Goss typically runs hundreds of checks in under one second, compared to minutes for InSpec or Serverspec, because it is a compiled Go binary running checks concurrently. **Q: Can I use Goss as a Kubernetes health check?** A: Yes. Run ``goss serve`` as a sidecar or init process and point your liveness/readiness probes at the health endpoint. **Q: Does Goss support remote testing?** A: Goss runs locally on the target host. For remote validation, deploy the binary and goss.yaml via SSH, Ansible, or container tooling. ## Sources - https://github.com/goss-org/goss - https://goss.rocks --- Source: https://tokrepo.com/en/workflows/06a4f0cf-3b42-11f1-9bc6-00163e2b0d79 Author: AI Open Source