This directory contains a Docker-based testing environment for validating chezmoi dotfiles installation in a clean Alpine Linux container.
# Build and run interactive shell
./docker-test.sh run
# Quick verification test
./docker-test.sh test
# Clean up everything
./docker-test.sh clean# Build the container
docker compose build
# Run interactive shell
docker compose run --rm dotfiles
# Run specific command
docker compose run --rm dotfiles fish -c "chezmoi verify"
# Clean up
docker compose down --rmi all- Base Image: Alpine Linux 3
- Shell: Fish (with bash also available)
- User:
tester(non-root) - Chezmoi: Latest version from get.chezmoi.io
- Working Directory:
/home/tester
The Dockerfile performs these steps:
- Installs fish, git, curl, and age
- Installs latest chezmoi
- Creates a test user with fish as default shell
- Initializes chezmoi from the dotfiles source
- Applies all dotfiles with
chezmoi apply -v - Verifies installation with
chezmoi verify
Check the verbose output to see which file is causing issues. Common problems:
- Templates requiring data: Ensure
.chezmoidata.tomlhas all required values - Platform-specific files: Check
.chezmoiignoreexcludes unsupported files - External dependencies: Some configs may require tools not installed in Alpine
The container defaults to fish shell. If fish installation fails, you can temporarily change CMD ["/bin/fish"] to CMD ["/bin/bash"] in the Dockerfile.
The container includes minimal tools. Add additional packages to the apk add line in the Dockerfile:
RUN apk add --no-cache \
bash \
fish \
git \
curl \
shadow \
age \
# Add more tools here
neovim \
tmuxThis Docker setup can be integrated into CI/CD pipelines:
# .github/workflows/test-dotfiles.yml
name: Test Dotfiles
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build and test dotfiles
run: docker compose run --rm dotfiles fish -c "chezmoi verify"Uncomment the volume section in docker-compose.yml to persist the home directory between runs:
volumes:
- dotfiles-test-home:/home/testerTest on different architectures:
# Build for ARM64 (e.g., Apple Silicon)
docker buildx build --platform linux/arm64 -t dotfiles-arm64 .
# Build for AMD64
docker buildx build --platform linux/amd64 -t dotfiles-amd64 .Start a container and keep it running for iterative testing:
docker compose up -d
docker compose exec dotfiles fish
# Make changes, test, repeat
docker compose down- Alpine-specific: Uses Alpine Linux, which may behave differently than Ubuntu/macOS
- Minimal tools: Only essential tools installed by default
- No systemd: Services that require systemd won't work
- Templates: Platform-specific templates may not render correctly on Alpine
- Chezmoi Documentation
- Alpine Linux Package Search
- Main dotfiles README:
README.md