Contribute a container
A Dockerfile is a recipe for a container image. Check the container catalog for an existing image before adding one.
You need Git and a GitHub account. These examples use a fictional exampletool at version 1.2.3; replace the names and versions with your own.
Add or update a container
1. Create a branch
If you cannot push to Dockers2, fork it on GitHub. Use Code on your fork to copy its clone URL and replace the URL below.
git clone https://github.com/CCBR/Dockers2.git
cd Dockers2
git switch -c add-exampletoolRun the remaining commands from the repository root.
2. Add a versioned Dockerfile
For a new image, create a directory and copy the template:
mkdir -p exampletool/ccbr_exampletool_1.2.3
cp template.Dockerfile exampletool/ccbr_exampletool_1.2.3/Dockerfile.v1The Dockerfile’s directory becomes the image name; the part after Dockerfile. becomes its tag. This example produces the stable images nciccbr/ccbr_exampletool_1.2.3:v1 and ghcr.io/ccbr/ccbr_exampletool_1.2.3:v1. Use a unique image name made of lowercase letters and numbers separated by ., _, or -, and a numbered tag such as v1 or v1.2.3. A plain Dockerfile does not trigger an automatic build.
Edit the copied Dockerfile:
- Choose a versioned base image and update the maintainer labels.
- Add installation commands and pin tool and dependency versions where possible. The template does not install your tool.
- Keep local
COPYorADDfiles in this directory or its subdirectories; this is the build context. Commit the required files. - Do not commit credentials, private data, or unnecessary large files.
For an update, prefer a new version such as Dockerfile.v2: rebuilding an existing tag can overwrite it. Keep older recipes’ supporting files unchanged, or version them too. If the image name includes the tool version, use a new directory for a new tool version.
Images are built for linux/amd64 by default. To support more architectures, add a single declaration near the top of the Dockerfile, for example:
# build-platforms: linux/amd64,linux/arm64Only list platforms supported by the base image, packages, and downloaded binaries. See the platform instructions.
3. Build and test locally (optional)
Local testing catches errors before CI runs, but you can skip it and test the preview image instead (step 4). Docker is not available on GFE laptops; use Podman. On macOS or Windows, start the Podman virtual machine first:
podman machine init # first time only
podman machine startBuild the example for linux/amd64:
podman build --platform linux/amd64 \
--file exampletool/ccbr_exampletool_1.2.3/Dockerfile.v1 \
--build-arg DOCKERFILE=Dockerfile.v1 \
--build-arg BUILD_DATE="$(date -u +%Y-%m-%d_%H:%M:%S)" \
--build-arg BUILD_TAG=v1 \
--build-arg REPONAME=ccbr_exampletool_1.2.3 \
--build-arg IMAGENAME=nciccbr/ccbr_exampletool_1.2.3:v1 \
--build-arg BASEIMAGENAME=nciccbr/ccbr_ubuntu_22.04:v4 \
--tag ccbr_exampletool_1.2.3:v1 \
exampletool/ccbr_exampletool_1.2.3If you change the template’s FROM image, update BASEIMAGENAME. On Apple silicon Macs, linux/amd64 builds use emulation and can be slow.
Check that the tool runs and reports the expected version:
podman run --rm --platform linux/amd64 \
localhost/ccbr_exampletool_1.2.3:v1 exampletool --versionUse your tool’s version command; adjust it for the image’s ENTRYPOINT if needed. Also test a small, non-sensitive input and check the output. Save the commands and results for your pull request.
4. Open a pull request
Commit and push your changes:
git add exampletool/ccbr_exampletool_1.2.3/
git commit -m "feat: add exampletool container"
git push -u origin add-exampletoolOpen a pull request (PR) against CCBR/Dockers2’s main branch. Include the tool and image versions, why the image is needed, and your test commands and results. Check build-docker-auto in the PR checks or Actions tab; a successful build does not replace testing the tool.
| Change | Automatic build |
|---|---|
| PR from a branch in Dockers2 | Builds and may publish v1-dev to Docker Hub and GHCR. |
| PR from a fork | Builds without publishing a preview. |
Merge to main |
Builds and publishes the stable v1 tag. |
Preview builds can be skipped if registry tags are up to date. The v1-dev tag is shared and can be overwritten; do not use it for production.
Only changes to a versioned Dockerfile or its source metadata trigger the workflow. When updating supporting files in a PR, also change the relevant Dockerfile in that push.
To test a published preview on Biowulf, start an interactive session and run:
module load singularity
singularity exec docker://nciccbr/ccbr_exampletool_1.2.3:v1-dev \
exampletool --versionSee the Biowulf container guide for setup and cache guidance. A fork PR does not publish a preview; ask a maintainer for help.
5. Wait for review and merge
A maintainer will review your PR. Address any feedback and wait for a maintainer to approve and merge it into main. After the merge, check that the stable build succeeded and the tag is available in both registries.
Publishing images
Automatic build
The automatic build workflow publishes images to Docker Hub under nciccbr and to GHCR under ghcr.io/ccbr. For a Dockerfile named Dockerfile.v2, it uses these tags:
| Trigger | Tag | Publishing |
|---|---|---|
Pull request to main |
v2-dev |
Docker Hub and GHCR for same-repository PRs; fork PRs build without publishing |
Push to an autobuild branch |
v2-dev |
Docker Hub and GHCR |
Push to main |
v2 |
Docker Hub and GHCR |
The -dev tag is shared by previews of the same image and version. A later successful push can overwrite another PR’s preview, so use the unsuffixed tag for stable images. Existing registry tags are not renamed or deleted.
Manual build
To build an image on demand, run the manual workflow from the Actions tab and select the Dockerfile. Choose dev for a preview or main for the unsuffixed version tag; stable tags can only be published from main. Enable push to publish to both registries; leave it unchecked to run without publishing.
Dispatch from another repository
To add or update an image from another repository, use the dispatch workflow. See Import a Dockerfile from another repository for instructions.
Docker build platforms
The CI workflows read the selected Dockerfile’s build-platforms declaration. When the declaration is absent or empty, the image is built for linux/amd64. To opt a Dockerfile into additional architectures, add a comment at the top of the file:
# build-platforms: linux/amd64,linux/arm64
FROM ubuntu:26.04List platforms as comma-separated os/arch[/variant] values, using any platform supported by docker buildx (for example, linux/arm/v7 or linux/ppc64le). Duplicates, malformed values, multiple declarations, and platforms the base image does not provide fail the build rather than silently publishing an incomplete image. For manual builds, a nonempty platforms input overrides the declaration and uses the same validation; leave it blank to use the Dockerfile’s selection. Enable push when manually building multiple platforms.
Only declare a platform after confirming the base image, packages, downloaded binaries, and other dependencies support it. Multi-platform builds use emulation on GitHub’s x86 runners and can take significantly longer. Published images include the requested platforms; your local container engine (Docker, Podman, Apptainer) selects the matching one automatically.
Import a Dockerfile from another repository
For a Dockerfile maintained elsewhere, use Actions > build-docker-dispatch > Run workflow in Dockers2. You need permission to run the workflow, and it must be able to access the source repository. Enter the source OWNER/REPO, ref, Dockerfile path, lowercase image name, and a tag such as v1. Use a source tag or commit; the image tag can be at most 124 characters, leaving room for the -dev suffix within Docker’s 128-character tag limit.
The source repository root must be the Dockerfile’s intended build context. Before running, check for credentials, private data, and unnecessary large files: the workflow copies and commits the entire checkout except .git.
The workflow records the exact source commit in .Dockerfile.<tag>.source.json next to the Dockerfile and publishes a -dev preview to Docker Hub and GHCR. After a successful build, it opens or updates a PR to main containing the Dockerfile, metadata, and copied context. Review the copied files and metadata, and test the preview; merging the PR triggers the stable build.
Automatic and manual builds use the checked-in snapshot without needing access to the source repository. Changes to the metadata also trigger a rebuild; keep it alongside the Dockerfile. Older dispatched Dockerfiles that do not include their source context must be dispatched again if they need files from the source repository. Rerun the dispatch when the source changes.
For on-demand builds of recipes already in Dockers2, see the manual build instructions. A build-only run can still be skipped if the registry tags are up to date.