Skip to main content
Towbar’s mongodb preset runs the reviewed MongoDB 8.0 image on amd64 or arm64. It listens on port 27017, stores data in /data/db, and authenticates against the admin database for health checks and managed operations.

Declare the resource

.towbar/resources/mongodb.resource.yml
Both variables are required by Towbar and initialize the root account on an empty data volume. Create application-specific databases and users after MongoDB is ready. Keep those credentials with the consuming app rather than reusing the root account.

Connect from an app

Containers on the application network can reach mongodb:27017. Include the appropriate authentication database in the app’s secret connection string. The optional tunnel binds 17017 only to server loopback for access over SSH.

Initialization and credential changes

The root initialization variables are used only for an empty /data/db volume. Replacing them later does not rotate the MongoDB user. Change the credential in MongoDB first, then update Towbar so its authenticated checks and operations continue to work.

Back up and restore

Towbar produces a compressed mongodump archive and restores it with mongorestore into a fresh target volume. Recovery requires MongoDB major version 8. Continue with Database backups and Database restores.
Last modified on September 22, 2026