Skip to content

Docker image: the HEALTHCHECK binds with the initial ROOT_PASSWORD, so the container turns unhealthy once the root password is changed #1092

Description

@vharseko

Problem

The image HEALTHCHECK binds as the root user with the password the container was started with (Dockerfile#L78):

HEALTHCHECK ... CMD test -f "$BOOTSTRAP_COMPLETE" && opendj/bin/ldapsearch ... --bindDN "$ROOT_USER_DN" --bindPassword "${ROOT_PASSWORD:-password}" ... --baseDN "" --searchScope base "(objectClass=*)" 1.1 || exit 1

ROOT_PASSWORD is only the initial root password (README: "Initial root user password"). Once an operator changes the Directory Manager password, which is what one is supposed to do with an initial password, every probe fails with 49 (Invalid Credentials) and the container becomes unhealthy for good, although the server serves normally.

Reproduced with openidentityplatform/opendj:latest (2026-07-17):

docker run -d --name hc --health-interval=5s -e ROOT_PASSWORD=secret123 openidentityplatform/opendj:latest
# wait until healthy
docker exec hc /opt/opendj/bin/ldappasswordmodify -h localhost -p 1389 \
  -D "cn=Directory Manager" -w secret123 -c secret123 -n rotated456
# The LDAP password modify operation was successful
docker inspect -f '{{.State.Health.Status}}' hc
# unhealthy   (last probe: 1 The LDAP search request failed: 49 (Invalid Credentials))

A second effect of the same line: every 30 s the probe puts the password on a command line, so it is readable from /proc/<pid>/cmdline of the probe's sh and java processes while it runs (seen in the container above).

Expected

The health check does not depend on a credential that the operator is expected to change, and passes no password on a command line.

The probe reads the root DSE with attribute list 1.1, which needs no bind: an anonymous search of the same entry succeeds on a default instance (ldapsearch -h localhost -p 1636 -Z -X -b "" -s base "(objectClass=*)" 1.1 returns dn: and exit code 0). The readiness part (the instance is bootstrapped, #898) is carried by the $BOOTSTRAP_COMPLETE marker, not by the bind.

Notes

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions