DockerSelf-Hosting

goss and dgoss with Docker: Test That Your Container Really Works Before You Ship It (Linux, Windows, Mac)

Before you start

  • 25 min read

Boxes marked Run in terminal are what you type; plain text explains why. Check what you need first

What you get in one minute#

goss is a free, open-source tool that checks a system against a YAML file of expectations (is port 80 listening, is nginx running, does this URL answer 200), and its wrapper dgoss runs those checks inside a throw-away copy of your Docker image, so a broken image fails in seconds on your machine or in CI instead of in production.

Goss logo, a green pixel-style mark on a grey square

Logo: the Goss project's own GitHub organisation (github.com/goss-org); its avatar is the only logo we found, because the repository has no logo file. The project code is Apache-2.0.

You do not install goss in your image. dgoss starts the image, copies in a goss binary and your goss.yaml, runs the tests there and deletes the container. The result is an exit code, so any CI can stop a release on it. Our example is one small nginx image.

WhatValue (official sources, read 5 December 2026)
Current versiongoss v0.4.10, released 26 July 2026 (previous: v0.4.9, 26 September 2024)
LicenceApache-2.0 (LICENSE at the release tag)
Files to pingoss_0.4.10_linux_x86_64.tar.gz (about 6 MB), goss_0.4.10_linux_arm64.tar.gz, and the dgoss script, all on the release page
Time neededAbout 30 minutes (our estimate, not measured)
PortsNone. goss serve can open 8080, but we do not use it
Official docsgoss.readthedocs.io and the repository

At a glance:

  • What it is: one static Go binary (under 10 MB, per the README) plus one bash script, dgoss. No server, no login, no web page.
  • What it checks: ports, processes, HTTP answers, files, packages, users, commands and more, from inside the container.
  • How you write tests: dgoss edit gives you a shell in your image where goss add writes the YAML for you.
  • Where it runs: Linux and Mac directly. On Windows through WSL 2, because dgoss is a bash script.
  • Not a scanner or a linter: our Trivy guide looks for security holes and our Hadolint guide reads Dockerfiles.

Which version. We pin v0.4.10. The project is slow: 22 months passed between v0.4.9 and v0.4.10, and the new release changed its file names (see Common mistakes). We found no report that stops a normal install.

How it fits together#

dgoss reads your image name and your goss.yaml, starts the image as a container, copies a Linux goss binary and your tests into it, runs goss validate inside, prints the result and removes the container. The exit code says pass or fail.

Flow: your image name and your goss.yaml go into the dgoss run script on your machine or CI runner; dgoss starts a test container with docker run -d, your app starts, goss validate runs inside the same container and checks port, process, HTTP and files, and reports pass or fail as an exit code that turns the CI job green or red

Drawn for this guide from the dgoss README and script at v0.4.10.

Three words. A gossfile is the YAML test file, goss.yaml by default. A resource is one kind of check, such as port, process, http or file. goss_wait.yaml is an optional second file that must pass before the real tests start.

Before you start#

Note: every image name, tag and path on this page is a dummy example (goss-demo, 1.0). Replace them with your own. goss needs no secrets, and a goss.yaml belongs in Git, so never put a password into it.

SystemWhat to have
LinuxDocker Engine, curl, tar, bash
WindowsWindows 10 or later, Docker Desktop with the WSL 2 engine and Linux containers, and a WSL 2 distribution such as Ubuntu
MacDocker Desktop (Intel or Apple Silicon), Terminal
Run in terminalbash
docker --version

Checklist:

  • [ ] docker --version prints a version
  • [ ] You know your CPU: x86_64 or arm64 (uname -m; on a Mac, arm64 means Apple Silicon)
  • [ ] Windows: Docker Desktop is in Linux container mode and WSL integration is on for your distribution (Settings, Resources, WSL integration)
  • [ ] You can write to ~/docker_volumes

Tested on 2026-12-05: Linux = not run, Windows = not run, Mac = not run. The commands come from the goss docs and the dgoss script at v0.4.10, read on 5 December 2026. We did not run any of them on a real machine.

Tip: The goss docs warn that native macOS and Windows goss builds are "alpha-quality". We do not use them. For dgoss only a Linux goss binary matters, because it runs inside a Linux container.

LLM Guide: let your AI assistant set it up#

Prefer to let an AI do the typing? Copy the block below into ChatGPT, Claude, Gemini or a local model. It first asks about your setup (system, Docker, CPU, CI), then follows only the path that fits you. It uses the same pinned versions as this guide. You still read each command before you run it.

Instructions for your AI assistantllm
You are my assistant for setting up goss and dgoss (tests that check a Docker image really works before I ship it).
Follow the DIY Lab Hub guide https://diylabhub.com/goss/ (checked 5 December 2026).
Work one step at a time. Before each command, say in one line what it does. Wait for my OK before anything that deletes data, stops a service, changes a firewall or router, or opens a port.
goss and dgoss are commands, not a service: there is no web page, no reverse proxy, no Traefik or Caddy and no HTTPS to set up. Do not offer any.

STEP 0 - FIND OUT MY SETUP. Ask me these questions (or have me run the read-only checks) before you do anything else:
1. Which system: Linux, Windows or Mac? dgoss is a bash script: it runs on Linux and Mac directly; on Windows it needs WSL 2 with a distribution such as Ubuntu and Docker Desktop in Linux-container mode with WSL integration on.
2. Is Docker installed? Check: docker --version
3. What is my CPU? Linux: uname -m (x86_64 or arm64). On a Mac, arm64 means Apple Silicon. The goss binary must match the CPU of the IMAGE, not only my computer.
4. Do I want to test the guide's small demo image (nginx with one page) first, or my own image? Which image name and tag? (Never real passwords in goss.yaml.)
5. Do I want to run it in CI: Forgejo Actions, Woodpecker CI, or only locally?
6. Is it OK to run the tests on my own machine? Whoever can run dgoss controls my Docker.

THEN FOLLOW THE MATCHING PATH:
- Docker missing: install Docker Engine (Linux) or Docker Desktop (Windows/Mac) from docs.docker.com first, then come back.
- Linux (x86_64): create ~/docker_volumes/goss/{bin,demo,config,logs,backups}. In ~/docker_volumes/goss/bin download from https://github.com/goss-org/goss/releases/download/v0.4.10: goss_0.4.10_linux_x86_64.tar.gz, goss_0.4.10_SHA256SUMS and dgoss. Check the hash: grep ' goss_0.4.10_linux_x86_64.tar.gz$' goss_0.4.10_SHA256SUMS | sha256sum -c -  then tar xzf the archive (only the goss file), chmod +rx dgoss, delete the archive and the sums file, add the bin folder to PATH. Do NOT pipe a curl install script into sh. On arm64 use goss_0.4.10_linux_arm64.tar.gz in all four places.
- Windows: in an administrator PowerShell run wsl --install -d Ubuntu (restart if asked), open the Ubuntu window, and do every step there, with files in the Linux home folder (not /mnt/c).
- Mac: keep the Linux goss binary in ~/docker_volumes/goss/linux (the file from the release matching the image's CPU: goss_0.4.10_linux_arm64.tar.gz on Apple Silicon, goss_0.4.10_linux_x86_64.tar.gz on Intel), check the hash with shasum -a 256 -c -, put dgoss in ~/docker_volumes/goss/bin, create ~/tmp, and add to ~/.zshrc: export PATH="$HOME/docker_volumes/goss/bin:$PATH", export GOSS_PATH="$HOME/docker_volumes/goss/linux/goss", export DGOSS_TEMP_DIR="$HOME/tmp". On a Mac the Linux binary cannot run in Terminal; check with ls -l $GOSS_PATH.
- Demo image: in ~/docker_volumes/goss/demo write an index.html ("Hello from goss-demo") and this Dockerfile, then docker build -t goss-demo:1.0 .
    FROM nginx:1.30.8-alpine
    COPY index.html /usr/share/nginx/html/index.html
- Generate tests: cd ~/docker_volumes/goss/demo, dgoss edit goss-demo:1.0, and inside the container shell run goss add port 80, goss add process nginx, goss add http http://localhost, goss add file /usr/share/nginx/html/index.html, then exit. This writes goss.yaml. Keep the checks that matter. All checks of one kind sit under ONE top-level key (two "file:" blocks silently drop the first). The process name is the binary name, not the command line.
- Run: dgoss run goss-demo:1.0, then echo "exit code: $?". Everything after "run" goes to docker run; goss options go into GOSS_OPTS (default "--color --format documentation").
- Slow starter: add goss_wait.yaml (port tcp:80 listening: true). dgoss runs it first with GOSS_WAIT_OPTS (default -r 30s -s 1s); for a heavy app use GOSS_WAIT_OPTS="-r 90s -s 2s".
- Forgejo Actions: a runner with a Docker daemon (label "docker", Docker-in-Docker). The job image has no Docker client, so download the static one (https://download.docker.com/linux/static/stable/x86_64/docker-29.10.1.tgz), install the pinned goss and dgoss with the hash check as above, and set GOSS_FILES_STRATEGY=cp (without it CI fails with "sh: 1: /goss/goss: not found") and GOSS_OPTS="--no-color --format documentation". Workflow file .forgejo/workflows/goss.yaml, then docker build -t goss-demo:ci . and dgoss run goss-demo:ci. On an arm64 runner use aarch64 and linux_arm64.
- Woodpecker CI: file .woodpecker/goss.yaml with step image docker:29.10.1-cli, environment GOSS_FILES_STRATEGY: cp and GOSS_OPTS, volume /var/run/docker.sock:/var/run/docker.sock (only for TRUSTED repositories; it gives the step control of the host's Docker), commands: apk add --no-cache bash curl, the pinned downloads with the hash check, docker build -t goss-demo:ci ., dgoss run goss-demo:ci. Example step:
    steps:
      - name: goss
        image: docker:29.10.1-cli

CHECK IT WORKED: the sha256 line prints OK. On Linux goss --version shows 0.4.10 and running dgoss alone prints "ERROR: USAGE: dgoss [run|edit] <docker_run_params>". docker image ls goss-demo lists tag 1.0. ls goss.yaml shows the file. dgoss run ends with a line "Count: <n>, Failed: 0, Skipped: 0" and exit code 0. Then break it on purpose: change status: 200 to status: 404 in goss.yaml, run again, and see Failed above 0 and a non-zero exit code. Change it back.

RULES FOR YOU:
- Use only v0.4.10 of goss and dgoss, nginx 1.30.8-alpine for the demo, and docker 29.10.1 in CI. Never latest, never "curl https://goss.rocks/install | sh", never the old file name goss-linux-amd64. dgoss only has "run" and "edit"; there is no "dgoss test".
- On an error, show it to me and read https://goss.readthedocs.io/en/stable/ before guessing.
- A pipeline with Docker access must not run on pull requests from people I do not trust. Test with test settings, never production keys or data volumes.
- Names like goss-demo:1.0 are dummy examples; ask me for my own image.
- Never ask me to paste passwords, tokens or keys into this chat.

Step 1: Install goss and dgoss#

dgoss copies one goss binary from your computer into the container (the script does cp "${GOSS_PATH}" ...), so it must be a Linux binary that matches the image's CPU. We skip the README's curl | sh installer, which it warns against for production, and check a hash instead.

Linux#

Run in terminalbash
mkdir -p ~/docker_volumes/goss/{bin,demo,config,logs,backups}
cd ~/docker_volumes/goss/bin
base=https://github.com/goss-org/goss/releases/download/v0.4.10
curl -fsSLO "$base/goss_0.4.10_linux_x86_64.tar.gz"
curl -fsSLO "$base/goss_0.4.10_SHA256SUMS"
grep ' goss_0.4.10_linux_x86_64.tar.gz$' goss_0.4.10_SHA256SUMS | sha256sum -c -
tar xzf goss_0.4.10_linux_x86_64.tar.gz goss
curl -fsSL -o dgoss "$base/dgoss"
chmod +rx dgoss
rm goss_0.4.10_linux_x86_64.tar.gz goss_0.4.10_SHA256SUMS
echo 'export PATH="$HOME/docker_volumes/goss/bin:$PATH"' >> ~/.bashrc
export PATH="$HOME/docker_volumes/goss/bin:$PATH"

On a 64-bit ARM machine (such as a Raspberry Pi) use goss_0.4.10_linux_arm64.tar.gz in the four places the name appears.

Windows (PowerShell)#

dgoss is a bash script, and the README documents only Linux and Mac. Our reading: use WSL 2, where it is Linux. In an administrator PowerShell:

Run in terminalpowershell
wsl --install -d Ubuntu

Restart if Windows asks, create the Linux user it offers, then open the Ubuntu window with wsl.

Docker Desktop must have WSL integration on for that distribution (Settings, Resources, WSL integration; it is on for the default Ubuntu). Then run the Linux commands above inside the Ubuntu window, and do every later step there too. Keep the files in the Linux home folder, not under /mnt/c.

Mac (Terminal)#

The README's Mac recipe: keep the Linux goss binary in a folder, point GOSS_PATH at it, and move dgoss's temp folder into your home, because /tmp is private on macOS. The README's example still names an old file; the file names below are the v0.4.10 ones.

Run in terminalbash
mkdir -p ~/docker_volumes/goss/{bin,linux,demo,config,logs,backups} ~/tmp
cd ~/docker_volumes/goss
base=https://github.com/goss-org/goss/releases/download/v0.4.10
file=goss_0.4.10_linux_arm64.tar.gz   # Intel Mac: goss_0.4.10_linux_x86_64.tar.gz
curl -fsSLO "$base/$file"
curl -fsSLO "$base/goss_0.4.10_SHA256SUMS"
grep " $file\$" goss_0.4.10_SHA256SUMS | shasum -a 256 -c -
tar xzf "$file" -C linux goss
curl -fsSL -o bin/dgoss "$base/dgoss"
chmod +rx bin/dgoss
rm "$file" goss_0.4.10_SHA256SUMS
cat >> ~/.zshrc << 'EOF'
export PATH="$HOME/docker_volumes/goss/bin:$PATH"
export GOSS_PATH="$HOME/docker_volumes/goss/linux/goss"
export DGOSS_TEMP_DIR="$HOME/tmp"
EOF
source ~/.zshrc

Check it worked. The sha256sum -c (Mac: shasum -c) line prints OK for the archive. On Linux, goss --version prints a version line with 0.4.10 and dgoss alone prints ERROR: USAGE: dgoss [run|edit] <docker_run_params> (from the script). On a Mac the Linux binary cannot run in Terminal, so check ls -l $GOSS_PATH instead. We did not run any of these.

Tip: The Linux CPU must match the image, not only your computer. An Apple Silicon Mac pulls arm64 images by default. If you run an amd64 image under emulation, point GOSS_PATH at the x86_64 file.

Step 2: Build a small web image to test#

Our example is nginx with one page. Lint the Dockerfile first with our Hadolint guide if you like. The tag 1.30.8-alpine is the newest of nginx's stable 1.30 line on Docker Hub and nginx.org (checked 5 December 2026; 1.31 is the mainline branch), and Alpine images have a shell, which dgoss needs.

Linux#

Run in terminalbash
cd ~/docker_volumes/goss/demo
cat > index.html << 'EOF'
<!doctype html>
<html><head><title>goss demo</title></head>
<body><h1>Hello from goss-demo</h1></body></html>
EOF
cat > Dockerfile << 'EOF'
FROM nginx:1.30.8-alpine
COPY index.html /usr/share/nginx/html/index.html
EOF
docker build -t goss-demo:1.0 .

Windows (PowerShell)#

Run the Linux commands above in the WSL Ubuntu window from Step 1.

Mac (Terminal)#

Same commands as Linux.

Check it worked. docker image ls goss-demo lists goss-demo with tag 1.0. On a Mac, docker image inspect --format '{{.Architecture}}' goss-demo:1.0 shows arm64 or amd64: that is the goss file you need.

Step 3: Generate the tests with dgoss edit#

dgoss edit starts the image, installs goss in it and drops you into a shell. What you write with goss add ends up in goss.yaml in your folder when you leave. You describe a working container by running it, not by guessing YAML.

Linux#

Run in terminalbash
cd ~/docker_volumes/goss/demo
dgoss edit goss-demo:1.0

At the shell prompt inside the container type:

Run in terminalbash
goss add port 80
goss add process nginx
goss add http http://localhost
goss add file /usr/share/nginx/html/index.html
exit

Windows (PowerShell)#

Open the WSL Ubuntu window and run the Linux commands above.

Mac (Terminal)#

Same commands as Linux.

When you exit, dgoss prints a line of the shape INFO: Copied '/goss/goss.yaml' from container to './goss.yaml' (from the script). The generated file can hold more attributes than we need (the docs list size, mode, owner and checksums for a file). Open it and keep the checks that matter. Our trimmed version, written from the goss docs (yours may list more lines):

File contentyaml
port:
  tcp:80:
    listening: true
process:
  nginx:
    running: true
http:
  http://localhost:
    status: 200
    body:
      - Hello from goss-demo
file:
  /usr/share/nginx/html/index.html:
    exists: true
    filetype: file
    contents:
      - Hello from goss-demo

Each top-level word is one resource, and all checks of one kind sit under one key. The process name is the binary name, not the command line (docs). goss add port 80 writes tcp:80 or tcp6:80, depending on how the program listens; keep what it wrote.

Check it worked. ls goss.yaml shows the file. goss autoadd nginx inside the shell is the shortcut: it adds matching port, process, user, group and package checks at once, but never command or http checks (docs).

Tip: Run goss add for the real thing. A check you invented by hand, such as tcp:8080 for a program that listens on 80, only fails later. Generate first, then edit.

Step 4: Run the tests, and make one fail#

dgoss run takes the same arguments you would give docker run: ports, -e variables, volumes, then the image. It needs ./goss.yaml in the folder where you run it.

Linux#

Run in terminalbash
cd ~/docker_volumes/goss/demo
dgoss run goss-demo:1.0
echo "exit code: $?"

Windows (PowerShell)#

In the WSL Ubuntu window, run the Linux commands above.

Mac (Terminal)#

Same commands as Linux, with GOSS_PATH and DGOSS_TEMP_DIR set as in Step 1.

We did not run this, so we cannot show real output. The script and the docs give this shape (the container ID, times and counts differ):

File contenttext
INFO: Starting docker container
INFO: Container ID: <8-characters>
INFO: Sleeping for 0.2
INFO: Container health
INFO: Running Tests
Port: tcp:80: listening: matches expectation: [true]
...
Total Duration: <seconds>s
Count: <n>, Failed: 0, Skipped: 0
INFO: Stopping container
INFO: Deleting container
exit code: 0

Check it worked. The line Count: <n>, Failed: 0 and exit code: 0.

Now break it on purpose. Change status: 200 to status: 404 in goss.yaml and run dgoss run goss-demo:1.0 again. You should see a Failed: count above 0 and a non-zero exit code, and goss prints what it expected next to what it found. Change it back. This proves the test can fail, which is the whole point.

Everything after run goes to docker run; goss's own options go into GOSS_OPTS (default --color --format documentation), for example GOSS_OPTS="--no-color --format documentation" for a CI log.

Tip: dgoss run deletes its container at the end, even when a test fails. To see what the script does, set DEBUG=true: it then prints every command and keeps its temp folder.

Step 5: Wait for slow starters#

Many apps need seconds before the port opens, and a test that runs too early fails a good image. Put the one condition that means "ready" in goss_wait.yaml next to goss.yaml:

Linux#

Run in terminalbash
cd ~/docker_volumes/goss/demo
cat > goss_wait.yaml << 'EOF'
port:
  tcp:80:
    listening: true
EOF

Windows (PowerShell)#

In the WSL Ubuntu window, run the Linux commands above.

Mac (Terminal)#

Same commands as Linux.

If the file exists, dgoss first runs it with GOSS_WAIT_OPTS, which defaults to -r 30s -s 1s (retry up to 30 seconds, one second apart), and only then runs goss.yaml. For a heavy app: GOSS_WAIT_OPTS="-r 90s -s 2s" dgoss run <image>.

Check it worked. The run now prints INFO: Found goss_wait.yaml, waiting for it to pass before running tests (from the script) before the tests.

Tip: Keep goss_wait.yaml to one cheap check. Wait for "the port is open", then let goss.yaml check everything else. A long wait file hides which part is slow.

Run it in CI: Forgejo Actions and Woodpecker#

Put Dockerfile, index.html and goss.yaml (and goss_wait.yaml) in your repository. Both examples build the image and run dgoss run; a failed test fails the pipeline. We did not run either.

One trap decides whether this works. In CI the job runs in a container and the Docker daemon is elsewhere (Docker-in-Docker, or the host). dgoss mounts a temp folder into the test container, but that folder exists only inside the job container, so the daemon cannot see it. The symptom in the issues is sh: 1: /goss/goss: not found; the fix, confirmed by the reporter, is GOSS_FILES_STRATEGY=cp, which the README calls "required especially when container daemon is not on the local machine". It copies the files in with docker cp; you lose tests against the container's log output.

Forgejo Actions. The job needs a Docker client and a daemon. Use a runner set up as in our Forgejo guide (label docker, image node:20-bookworm, Docker-in-Docker), and see the Forgejo page on Docker in Actions. Without a daemon the job fails with Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?. The job image has no Docker client, so we download Docker's static client. Save as .forgejo/workflows/goss.yaml:

File contentyaml
on: [push, pull_request]
jobs:
  goss:
    runs-on: docker
    steps:
      - uses: actions/checkout@v4
      - name: Install the Docker client, goss and dgoss (pinned)
        run: |
          set -eu
          curl -fsSL https://download.docker.com/linux/static/stable/x86_64/docker-29.10.1.tgz \
            | tar xz --strip-components=1 -C /usr/local/bin docker/docker
          base=https://github.com/goss-org/goss/releases/download/v0.4.10
          curl -fsSLO "$base/goss_0.4.10_linux_x86_64.tar.gz"
          curl -fsSLO "$base/goss_0.4.10_SHA256SUMS"
          grep ' goss_0.4.10_linux_x86_64.tar.gz$' goss_0.4.10_SHA256SUMS | sha256sum -c -
          tar xzf goss_0.4.10_linux_x86_64.tar.gz -C /usr/local/bin goss
          curl -fsSL -o /usr/local/bin/dgoss "$base/dgoss"
          chmod +rx /usr/local/bin/dgoss
      - name: Build and test the image
        env:
          GOSS_FILES_STRATEGY: cp
          GOSS_OPTS: "--no-color --format documentation"
        run: |
          docker build -t goss-demo:ci .
          dgoss run goss-demo:ci

On an arm64 runner use aarch64 in the Docker URL and linux_arm64 for goss.

Woodpecker CI. Woodpecker starts each step in a container and runs commands with /bin/sh. The docker image has the client but no bash, which dgoss needs, so we add it. Mounting the host socket (volumes) works only for trusted repositories, per the Woodpecker docs, and gives the step control of the host's Docker. See our Woodpecker guide. Save as .woodpecker/goss.yaml:

File contentyaml
when:
  - event: [push, pull_request]

steps:
  - name: goss
    image: docker:29.10.1-cli
    environment:
      GOSS_FILES_STRATEGY: cp
      GOSS_OPTS: "--no-color --format documentation"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    commands:
      - apk add --no-cache bash curl
      - base=https://github.com/goss-org/goss/releases/download/v0.4.10
      - curl -fsSLO "$base/goss_0.4.10_linux_x86_64.tar.gz"
      - curl -fsSLO "$base/goss_0.4.10_SHA256SUMS"
      - grep ' goss_0.4.10_linux_x86_64.tar.gz$' goss_0.4.10_SHA256SUMS | sha256sum -c -
      - tar xzf goss_0.4.10_linux_x86_64.tar.gz -C /usr/local/bin goss
      - curl -fsSL -o /usr/local/bin/dgoss "$base/dgoss"
      - chmod +rx /usr/local/bin/dgoss
      - docker build -t goss-demo:ci .
      - dgoss run goss-demo:ci

Both pipelines download pinned files and check the archive hash. The goss README itself warns that using latest in a CI pipeline "may lead to unexpected behaviour".

Tip: Do not run a pipeline with Docker access on pull requests from people you do not trust. A job that can start containers can do far more than run your test. The Forgejo docs describe the same risk.

Put it behind HTTPS with Traefik? You do not need to#

goss and dgoss are commands, not a service: no port, no web page, nothing to put behind Traefik or Caddy. The optional goss serve opens /healthz on port 8080 and shows details of the tested system. We do not use it and would never put it on the internet.

With Traefik#

No labels or routes are needed.

Without Traefik: Caddy#

No reverse_proxy line is needed for the same reason. If your app serves HTTPS with a local certificate, the http resource has allow-insecure: true and a ca-file setting for this (goss docs). For browser tools with HTTPS see our Traefik and Caddy guides.

Security and testing#

ControlHow
Docker accessdgoss runs docker run, exec, cp and rm. Whoever can run it controls your Docker: use your own machine or a CI you trust
Test filesgoss.yaml goes into Git and holds no secrets. A command check runs code in the test container, so review changes to it
Real imagesdgoss starts your image with your flags. Give it test settings, never production keys or data volumes
Temp filesThe script makes its temp folder world-writable (chmod 777) and removes it afterwards

Quick test of your whole setup:

Run in terminalbash
cd ~/docker_volumes/goss/demo
dgoss run goss-demo:1.0 && echo PASS

Common mistakes#

MistakeWhy it happensDo this instead
Downloading goss-linux-amd64 from an old README, chat answer or script (issue 1088)v0.4.10 no longer ships that file. The URL gives a 404 and, without curl -f, a tiny error file saved as your gossUse goss_0.4.10_linux_x86_64.tar.gz and check it with goss_0.4.10_SHA256SUMS (Step 1)
curl https://goss.rocks/install | sh failing with gzip: stdin: not in gzip format (issue 1085)In July 2026 the installer looked up a release whose files were missing. It was fixed by v0.4.10Pin a version and download the archive yourself
Error: file error: open /goss/goss.yaml: no such file or directory (issue 588)You ran dgoss run in a folder without goss.yamlcd to the folder with goss.yaml, or set GOSS_FILES_PATH
sh: 1: /goss/goss: not found in CI (issue 588, same text in issue 305)The daemon cannot see the temp folder that the job container made, so the bind mount is emptySet GOSS_FILES_STRATEGY=cp (the reporter confirmed it worked)
A port test fails with Expected <bool>: false to equal <bool>: true although the app listens (issue 366, issue 149)The program listens on IPv6, so goss sees tcp6:5001, not tcp:5001Run goss add port <n> inside dgoss edit and keep what it wrote
tcp4:8080 fails but tcp:8080 passes (issue 1006, open)Reported on 0.4.9 when the kernel has IPv6 on; we did not check v0.4.10Use tcp:<port> (the reporter says it works) and the ip: list to check the address
exec: "sh": executable file not found in $PATH (issue 870)goss runs command checks with sh -c, and the dgoss script runs goss with docker exec ... sh -c. A scratch or distroless image has no shTest a build stage that has a shell, or see our distroless and cdebug guides
Two file: blocks in one goss.yamlYAML keeps only the last one, so the first block's checks silently vanish (docs). Since v0.4.3 goss prints a warningPut all checks of one kind under one key
A number in a string check stops matching after v0.4.0Matching is type-aware: - 123 is a number, not text (release notes)Write - "123"
Native macOS or Windows goss ends with Terminating.Those builds exit unless GOSS_USE_ALPHA=1 is set (source, docs)For dgoss use the Linux build in GOSS_PATH
AI assistants: goss-linux-amd64, releases/latest/download/... or curl | sh with no versionAnswers copy the old README, which still shows that file at the v0.4.10 tagPin v0.4.10 and use the archive names from the release page
AI assistants: dgoss run --format junit <image> or dgoss testdgoss only has run and edit, and passes everything after run to docker run (script). goss options belong in GOSS_OPTSGOSS_OPTS="--format junit" dgoss run <image>
AI assistants: a process: key with the whole command line, such as nginx -g daemon offThe docs' note says the check compares the binary name, not the arguments, and a full command line is an easy guessUse nginx. Find the name with cat -E /proc/<PID>/comm

Tip: After every change to goss.yaml, run dgoss run once with a deliberately wrong value, as in Step 4. A test that cannot fail tells you nothing.

Tip: The README at the v0.4.10 tag still shows the old download name. Read the master README for install steps, but pin the release.

Troubleshooting#

ProblemSolution
dgoss says it cannot find gossPut goss on your PATH, or set GOSS_PATH to the Linux binary
Windows: docker is missing inside WSLIn Docker Desktop turn on WSL integration for your distribution and use Linux containers
Tests pass on your machine and fail in CISet GOSS_FILES_STRATEGY=cp, and check the CPU of the goss file against the runner
The test runs before the app is readyAdd goss_wait.yaml and raise GOSS_WAIT_OPTS
Need goss's own debug outputdgoss run -e GOSS_LOGLEVEL=DEBUG <image> (README)

Exact error texts#

  • ERROR: Couldn't find goss installation, please set GOSS_PATH to it (dgoss script): there is no goss on the PATH and GOSS_PATH is empty.
  • ERROR: the container failed to start (script): the container exited before the tests. The script prints its log above the message. Read it, or run docker run by hand.
  • ERROR: goss_wait.yaml never passed (script): the wait condition did not come true in time. Raise GOSS_WAIT_OPTS or fix the app.
  • ERROR: Wrong goss files strategy used! Correct options are "mount" or "cp". and ERROR: Runtime must be one of docker or podman (script): a typo in GOSS_FILES_STRATEGY or CONTAINER_RUNTIME. Our Podman guide covers the other runtime.
  • Error: file error: open /goss/goss.yaml: no such file or directory (issue 588): no goss.yaml in the current folder.
  • /goss/goss: no such file or directory (issue 923, closed without a reply from the reporter): the maintainer's guess was a goss binary for the wrong CPU or a missing PATH entry, and he suggested GOSS_PATH.

Known bugs (open, December 2026)#

Issue 149 (open since 2016): goss may see a dual-stack port as tcp6. Issue 1006: tcp4: checks fail when IPv6 is on. Issue 1152: text patterns lose leading / and !, and goss add command writes such patterns itself. We found nothing that stops the checks in this guide.

Updates and backups#

Update goss. Read the release notes, change 0.4.10 to the new version in the download lines (Step 1 and your CI files), and run your tests once. Because goss lives outside your image, updating it never changes your image.

What to back up. Dockerfile, goss.yaml and goss_wait.yaml belong in Git, so Git is the real backup. The binaries in bin can be downloaded again. This script is a safety copy of the demo folder.

Linux and Mac#

Save as ~/docker_volumes/goss/backup.sh:

File contentbash
#!/usr/bin/env bash
set -euo pipefail
base="$HOME/docker_volumes/goss"
tar -czf "$base/backups/goss-demo-$(date +%F).tar.gz" -C "$base" demo

Run chmod 700 on it and add this line with crontab -e (on a Mac write /Users/<your-user>/...):

File contenttext
0 3 * * * /home/<your-user>/docker_volumes/goss/backup.sh

Windows (PowerShell)#

The files live in WSL. In Task Scheduler run powershell.exe daily at 03:00 with this argument:

Codepowershell
-NoProfile -Command "wsl.exe -e bash -lc '$HOME/docker_volumes/goss/backup.sh'"

Save the Linux backup.sh inside WSL first.

Restore test#

Unpack an archive into an empty folder, then run the tests from there:

Run in terminalbash
mkdir -p /tmp/goss-restore && tar -xzf ~/docker_volumes/goss/backups/goss-demo-<date>.tar.gz -C /tmp/goss-restore
cd /tmp/goss-restore/demo && dgoss run goss-demo:1.0

It should end with Failed: 0 again. On a Mac use a folder under your home instead of /tmp.

Performance and resources#

The README calls goss fast ("small-medium test suites are near instantaneous") and small (under 10 MB; the Linux x86_64 archive is about 6 MB). We measured nothing. The cost you will notice is the container start plus GOSS_SLEEP (0.2 seconds). Knobs: GOSS_WAIT_OPTS for slow apps and --max-concurrent <num> in GOSS_OPTS.

FAQ#

Do I install goss in my image? No. dgoss copies the binary in for the test and removes the container afterwards. The README also describes goss serve as a health endpoint, which does need goss inside the image; that is a different, optional use.

Can I test an image that has no shell? Not with dgoss as it is written, because it runs goss through sh. Test a build stage that has a shell. Our own idea, not from the docs: run the finished container with a published port and point a goss on your host at it with an http check.

How is this different from container-structure-test? That tool checks the contents of an image without running it: file existence, command output and metadata. Its README says it is not an officially supported Google project and is in maintenance mode. goss checks a running container. They answer different questions. After you shrink an image with our Slim guide, run dgoss on the result to see that it still works.

Compose, Kubernetes, Podman? The README lists user-submitted wrappers dcgoss (Compose) and kgoss (Kubernetes), and dgoss accepts CONTAINER_RUNTIME=podman. We tried none of them.

Sources#

Checked against the official docs on 2026-12-05. Nothing was run on a real machine by DIY Lab Hub; the commands come from the docs, the dgoss script, the release files and the issues above.

Try one of these