
How to Run Tests in Docker for a Clean Environment
Run tests in Docker for a clean, repeatable environment: a one-line run, a test stage, Compose with services, dependency caching and file ownership.
Tag
38 posts

Run tests in Docker for a clean, repeatable environment: a one-line run, a test stage, Compose with services, dependency caching and file ownership.

Harden Docker containers from the command line: non-root user, read-only filesystem, dropped capabilities, no new privileges and resource limits.

Use Docker Compose watch for live reload: configure sync, rebuild and sync restart actions, ignore noisy paths and know when a bind mount is still better.

Manage Compose variants with profiles, override files, multiple -f files and include: what merges, what replaces, and how to see the final result.

Make Compose wait for a ready database: write a healthcheck, use depends_on with condition service_healthy, tune the timings and use up --wait in scripts.

A Docker Compose tutorial for local development: write a compose file for an app and a database, start it, read logs, run commands inside and tear it down.

Publish Docker ports safely: the difference between EXPOSE and -p, binding to localhost, the firewall bypass, random ports and how to check what is listening.

Understand Docker networks and container DNS: why the default bridge has none, how user defined networks resolve names, aliases, and reaching the host.

Build interactive pickers with fzf for git branches and commits, Docker containers and man pages: previews, multi select, key bindings and safe quoting.

Debug a misbehaving Docker container: read logs and exit codes, check OOM kills, open a shell, debug images without a shell and compare configuration.

Build and push a Docker image from CI with GitHub Actions: log in, tag from git, use the build cache, push only on trusted events and keep credentials safe.

Fix permission denied on Docker bind mounts by matching user IDs, using the user option, fixing ownership, and handling SELinux labels and rootless mode.