Get started
This guide walks you through setting up your first ContainerHive project from scratch.
1. Install ContainerHive
Download the latest binary for your platform or use the Docker image. See Install ContainerHive for all options.
2. Set up BuildKit
ContainerHive uses BuildKit under the hood. Start a BuildKit daemon:
3. Create your project
Create a hive.yml at the root of your project:
For all configuration options, see Configure your project.
4. Define an image
Create an image directory with a definition and Dockerfile:
image.yml:
Dockerfile:
Versions defined in image.yml are automatically passed as Docker build arguments with a _VERSION suffix (app becomes APP_VERSION). See Write your Dockerfiles for details.
5. Add tests (optional)
Create a test.yml (or test.yml.gotpl if you need template variables) next to the Dockerfile:
schemaVersion: 2.0.0
commandTests:
- name: "OS check"
command: "cat"
args: ["/etc/os-release"]
expectedOutput: ["Ubuntu"]
See Define your tests for all test types and template usage.
6. Generate, build, and test
# Discover project and render configurations
ch generate
# Build images
ch build
# Run tests
ch test
7. Generate SBOMs (optional)
Generates CycloneDX JSON SBOMs for all built images. See How SBOM generation works.
8. Set up CI (optional)
Generate a CI pipeline for your provider:
ch template ci --provider github --output .github/workflows/build.yml
ch template ci --provider gitlab --output .gitlab-ci.yml
See Generate CI pipelines for all options.
Next steps
- Write your Dockerfiles — versions, secrets, and inter-image dependencies
- Define your images — tags, variants, secrets, and dependencies
- Use the CLI — full command reference
- Test your containers — run and filter tests
- Generate CI pipelines — GitLab CI and GitHub Actions
- How dependency resolution works — build ordering