Get the Docker Image

From version: 1.18.0

The Certdog image holds Certdog and its database (MongoDB) in one container. It is made from the Linux installer, so it is configured just as a Linux installation is. It is on Docker Hub: https://hub.docker.com/r/krestfield/certdog

Run it

docker run -d -p 443:443 -p 80:80 -p 8443:8443 -v certdog-data:/var/lib/certdog --name certdog krestfield/certdog

Certdog is configured on each container’s first start, not when the image was built, so every container has its own database passwords and master password. The first start takes a minute or two longer; docker logs certdog shows what it is doing:

The first start of a container

docker ps shows the container as healthy once Certdog is answering. Then go to https://127.0.0.1/certdog and log in as admin with the password password. You are asked to choose a new password straight away.

The -v certdog-data:/var/lib/certdog keeps Certdog’s data in a named volume, so that it is kept when the container is removed, and can be given to the container of a newer image to upgrade it. Without it, Docker makes an anonymous volume, which is removed with the container

If port 443 is already in use

Map other ports on the host, e.g. 1443 and 1480, and go to https://127.0.0.1:1443/certdog:

docker run -d -p 1443:443 -p 1480:80 -p 8443:8443 -v certdog-data:/var/lib/certdog --name certdog krestfield/certdog

Settings

These environment variables are used on the container’s first start:

Variable  
CERTDOG_FIRST_ADMIN_USERNAME The first administrator (default admin)
CERTDOG_FIRST_ADMIN_EMAIL Their email address (default certdog@example.com)
CERTDOG_FIRST_ADMIN_PASSWORD Their password. Without it, it is password, which must be changed at first login
CERTDOG_FIRST_ADMIN_PASSWORD_FILE A file holding their password, e.g. a Docker secret, instead of the above (which docker inspect would show)
CERTDOG_ENABLE_MCP y to enable AI assistant access (MCP). See Certdog AI (MCP)

For example:

docker run -d -p 443:443 -p 80:80 -p 8443:8443 -v certdog-data:/var/lib/certdog \
    -e CERTDOG_FIRST_ADMIN_EMAIL=pki@example.com \
    -e CERTDOG_FIRST_ADMIN_PASSWORD_FILE=/run/secrets/certdog_admin \
    --name certdog krestfield/certdog

The data

Everything the container changes is in /var/lib/certdog, the volume:

Folder What it holds
/var/lib/certdog/certdog The installation: configuration, certificates, the master password, logs
/var/lib/certdog/mongodb The database, its configuration and its TLS key
/var/lib/certdog/backups The installations that upgrades replaced

The master password is in /var/lib/certdog/certdog/config/MASTERPASSWORD.txt, and the database passwords in /var/lib/certdog/certdog/config/pwd/DBPASSWORDS.txt. Certdog’s logs are in /var/lib/certdog/certdog/logs.

To get a shell in the running container:

docker exec -it certdog bash

Upgrade

Run the new image with the same volume:

docker stop certdog
docker rm certdog
docker pull krestfield/certdog:<new version>
docker run -d -p 443:443 -p 80:80 -p 8443:8443 -v certdog-data:/var/lib/certdog --name certdog krestfield/certdog:<new version>

When it starts, the container sees that the volume holds an older version and upgrades it, as upgrading on Linux does: it keeps the configuration, certificates, logs and database, adds the settings the new version needs, and backs up the previous installation to /var/lib/certdog/backups. docker logs certdog shows what it did:

The container upgrading the data in its volume

An image older than the version in the volume does not start, and changes nothing.

Back up the volume before upgrading, e.g. docker run --rm -v certdog-data:/data -v "$PWD":/backup debian tar -czf /backup/certdog-data.tar.gz -C /data . with the container stopped

Going back to the previous version

Stop the container, restore the backup with a one-off container, then run the previous image:

docker stop certdog
docker rm certdog
docker run --rm -v certdog-data:/var/lib/certdog krestfield/certdog:<new version> ls /var/lib/certdog/backups
docker run --rm -v certdog-data:/var/lib/certdog krestfield/certdog:<new version> \
    /opt/certdog/install/upgrade.sh --install-dir /var/lib/certdog/certdog \
    --restore /var/lib/certdog/backups/<backup> --yes --no-start
docker run -d -p 443:443 -p 80:80 -p 8443:8443 -v certdog-data:/var/lib/certdog --name certdog krestfield/certdog:<previous version>

The database is not changed by an upgrade (apart from new indexes), so it does not need to be restored.

From an image before 1.18

Containers made from images before 1.18 kept their data inside the container, not in a volume, so they cannot be upgraded this way. Copy out what you need (e.g. with docker cp) before removing such a container, and set up the new one again.

Issue a certificate

A new container has no certificate issuers yet. To issue certificates, create a Local CA and a certificate issuer: see Getting Started and Create a Local Certificate Issuer.