Skip to main content

Configuration

Gotenberg is configured via CLI flags or environment variables. Override the Docker image's default command to set them.

How To

With the Docker CLI:

docker run --rm -p "3000:3000" gotenberg/gotenberg:8 gotenberg --my-module-property=foo

Or with Docker Compose:

compose.yaml
services:
# Your other services.

gotenberg:
image: gotenberg/gotenberg:8
command:
- "gotenberg"
- "--my-module-property=foo"

Override the command, not the entrypoint. See this issue for details.


You can also use environment variables. With the Docker CLI:

docker run --rm -p "3000:3000" -e MY_MODULE_PROPERTY=foo gotenberg/gotenberg:8

Or with Docker Compose:

compose.yaml
services:
# Your other services.

gotenberg:
image: gotenberg/gotenberg:8
environment:
MY_MODULE_PROPERTY: "foo"

API

HTTP/1 and HTTP/2 (H2C) server.

FlagEnvironment variableDescriptionDefault
--api-portAPI_PORTSet the port on which the API should listen.3000
--api-port-from-envAPI_PORT_FROM_ENVSet the environment variable with the port on which the API should listen - override the default port.None
--api-bind-ipAPI_BIND_IPSet the IP address the API should bind to for incoming connections.0.0.0.0
--api-tls-cert-fileAPI_TLS_CERT_FILEPath to the TLS/SSL certificate file - for HTTPS support.None
--api-tls-key-fileAPI_TLS_KEY_FILEPath to the TLS/SSL key file - for HTTPS support.None
--api-start-timeoutAPI_START_TIMEOUTSet the time limit for the API to start.30s
--api-timeoutAPI_TIMEOUTSet the time limit for requests.30s
--api-body-limitAPI_BODY_LIMITSet the body limit for multipart/form-data requests - it accepts values like 5MB, 1GB, etc.None
--api-root-pathAPI_ROOT_PATHSet the root path of the API - for service discovery via URL paths/
--api-correlation-id-headerAPI_CORRELATION_ID_HEADERSet the header name to use for identifying requests.Gotenberg-Trace
--api-enable-basic-authAPI_ENABLE_BASIC_AUTHEnable basic authentication - will look for the GOTENBERG_API_BASIC_AUTH_USERNAME and GOTENBERG_API_BASIC_AUTH_PASSWORD environment variables.false
--api-download-from-allow-listAPI_DOWNLOAD_FROM_ALLOW_LISTSet the allowed URLs for the download from feature using regular expressions. Accepts multiple patterns via comma-separated values or repeated flags.All
--api-download-from-deny-listAPI_DOWNLOAD_FROM_DENY_LISTSet the denied URLs for the download from feature using regular expressions. Accepts multiple patterns via comma-separated values or repeated flags.Internal ranges (see below)
--api-download-from-max-retryAPI_DOWNLOAD_FROM_MAX_RETRYSet the maximum number of retries for the download from feature.4
--api-disable-download-fromAPI_DISABLE_DOWNLOAD_FROMDisable the download from feature.false
--api-disable-health-check-route-telemetryAPI_DISABLE_HEALTH_CHECK_ROUTE_TELEMETRYDisable telemetry for the health check route.true
--api-disable-root-route-telemetryAPI_DISABLE_ROOT_ROUTE_TELEMETRYDisable telemetry for the root route.true
--api-disable-debug-route-telemetryAPI_DISABLE_DEBUG_ROUTE_TELEMETRYDisable telemetry for the debug route.true
--api-disable-version-route-telemetryAPI_DISABLE_VERSION_ROUTE_TELEMETRYDisable telemetry for the version route.true
--api-enable-debug-routeAPI_ENABLE_DEBUG_ROUTEEnable debug route.false
warning

As of Gotenberg 8.29.0, --api-trace-header has been deprecated in favor of --api-correlation-id-header, and --api-disable-health-check-logging has been deprecated in favor of --api-disable-health-check-route-telemetry.

Breaking change

Since Gotenberg 8.31.0, --api-download-from-deny-list defaults to:

^https?://(10\.|172\.(1[6-9]|2[0-9]|3[01])\.|192\.168\.|169\.254\.|0\.0\.0\.0|127\.|localhost|\[::1\]|\[fd)

It blocks loopback, RFC1918, link-local, and IPv6 unique-local ranges. Gotenberg also resolves each target host and rejects non-public addresses, pinning the dial to the validated IP to prevent DNS rebinding. Set --api-download-from-allow-list to fetch from internal hosts. See Outbound URL Security.

Chromium

The Chromium module interacts with the Chromium browser to convert HTML documents to PDF.

A single Chromium browser manages the conversions in a stateful mode, enabling quicker single conversions. A Chromium browser can handle up to 6 parallel operations.

During periods of heavy load, incoming requests will accumulate in the queue until they are processed, time out, or the queue reaches its maximum capacity. In the latter case, the request will be terminated prematurely.

To maintain performance under a heavy load, consider increasing the number of Gotenberg instances.

caution

Before Gotenberg 8.22.0, the amd64 image used Google Chrome (stable), while other architectures used Chromium. Now all architectures use Chromium.

The following flags allow you to configure the Chromium module:

FlagEnvironment variableDescriptionDefault
--chromium-restart-afterCHROMIUM_RESTART_AFTERNumber of conversions after which Chromium will automatically restart. Set to 0 to disable this feature.100*
--chromium-max-queue-sizeCHROMIUM_MAX_QUEUE_SIZEMaximum request queue size for Chromium. Set to 0 to disable this feature.0
--chromium-max-concurrencyCHROMIUM_MAX_CONCURRENCYMaximum number of concurrent conversions. Chromium supports up to 6.6
--chromium-auto-startCHROMIUM_AUTO_STARTAutomatically launch Chromium upon initialization if set to true; otherwise, Chromium will start at the time of the first conversion.false
--chromium-start-timeoutCHROMIUM_START_TIMEOUTMaximum duration to wait for Chromium to start or restart.20s
--chromium-idle-shutdown-timeoutCHROMIUM_IDLE_SHUTDOWN_TIMEOUTShut down Chromium after this idle duration. Set to 0 to disable.0s
--chromium-allow-file-access-from-filesCHROMIUM_ALLOW_FILE_ACCESS_FROM_FILESAllow file:// URIs to read other file:// URIs.false
--chromium-allow-insecure-localhostCHROMIUM_ALLOW_INSECURE_LOCALHOSTIgnore TLS/SSL errors on localhost.false
--chromium-allow-listCHROMIUM_ALLOW_LISTSet the allowed URLs for Chromium using regular expressions. Accepts multiple patterns via comma-separated values or repeated flags.All
--chromium-deny-listCHROMIUM_DENY_LISTSet the denied URLs for Chromium using regular expressions. Accepts multiple patterns via comma-separated values or repeated flags.^file:(?!//\/tmp/).*
--chromium-ignore-certificate-errorsCHROMIUM_IGNORE_CERTIFICATE_ERRORSIgnore the certificate errors.false
--chromium-disable-web-securityCHROMIUM_DISABLE_WEB_SECURITYDon't enforce the same-origin policy.false
--chromium-incognitoCHROMIUM_INCOGNITODeprecated. Ignored since Gotenberg 8.29.0.false
--chromium-host-resolver-rulesCHROMIUM_HOST_RESOLVER_RULESSet custom mappings to the host resolver.None
--chromium-proxy-serverCHROMIUM_PROXY_SERVERSet the outbound proxy server; this switch only affects HTTP and HTTPS requests.None
--chromium-clear-cacheCHROMIUM_CLEAR_CACHEClear Chromium cache between each conversion.false
--chromium-clear-cookiesCHROMIUM_CLEAR_COOKIESClear Chromium cookies between each conversion.false
--chromium-disable-javascriptCHROMIUM_DISABLE_JAVASCRIPTDisable JavaScript.false
--chromium-disable-routesCHROMIUM_DISABLE_ROUTESDisable the routes.false

*Prior to Gotenberg 8.15.2, restarting Chromium resulted in zombie processes.

LibreOffice

The LibreOffice module interacts with LibreOffice to convert numerous documents to PDF, thanks to unoconv.

A single LibreOffice instance manages the conversions in a stateful mode, enabling quicker single conversions. However, due to a lock mechanism, a LibreOffice instance cannot execute parallel operations.

During periods of heavy load, incoming requests will accumulate in the queue until they are processed, time out, or the queue reaches its maximum capacity. In the latter case, the request will be terminated prematurely.

To maintain performance under a heavy load, consider increasing the number of Gotenberg instances.

The following flags allow you to configure the LibreOffice module:

FlagEnvironment variableDescriptionDefault
--libreoffice-restart-afterLIBREOFFICE_RESTART_AFTERNumber of conversions after which LibreOffice will automatically restart. Set to 0 to disable this feature.10
--libreoffice-max-queue-sizeLIBREOFFICE_MAX_QUEUE_SIZEMaximum request queue size for LibreOffice. Set to 0 to disable this feature.0
--libreoffice-auto-startLIBREOFFICE_AUTO_STARTAutomatically launch LibreOffice upon initialization if set to true; otherwise, LibreOffice will start at the time of the first conversion.false
--libreoffice-start-timeoutLIBREOFFICE_START_TIMEOUTMaximum duration to wait for LibreOffice to start or restart.20s
--libreoffice-idle-shutdown-timeoutLIBREOFFICE_IDLE_SHUTDOWN_TIMEOUTShut down LibreOffice after this idle duration. Set to 0 to disable.0s
--libreoffice-disable-routesLIBREOFFICE_DISABLE_ROUTESDisable the routes.false

Switch Language

By default, LibreOffice uses the English language when it converts documents to PDF. You may override this behavior by building your own Docker image.

For instance, with the German language:

Gotenberg 8.23.1 and after

FROM gotenberg/gotenberg:8

USER root

RUN apt-get update -qq &&\
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends -t trixie-backports libreoffice-l10n-de &&\
sed -i '/de_DE.UTF-8/s/^# //g' /etc/locale.gen &&\
locale-gen &&\
# Cleanup.
# Note: the Debian image does automatically a clean after each install thanks to a hook.
# Therefore, there is no need for apt-get clean.
# See https://stackoverflow.com/a/24417119/3248473.
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

ENV LANG de_DE.UTF-8
ENV LANGUAGE de_DE:de
ENV LC_ALL de_DE.UTF-8

USER gotenberg

Prior Gotenberg 8.22.0

FROM gotenberg/gotenberg:8

USER root

RUN apt-get update -qq &&\
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends -t bookworm-backports libreoffice-l10n-de &&\
sed -i '/de_DE.UTF-8/s/^# //g' /etc/locale.gen &&\
locale-gen &&\
# Cleanup.
# Note: the Debian image does automatically a clean after each install thanks to a hook.
# Therefore, there is no need for apt-get clean.
# See https://stackoverflow.com/a/24417119/3248473.
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

ENV LANG de_DE.UTF-8
ENV LANGUAGE de_DE:de
ENV LC_ALL de_DE.UTF-8

USER gotenberg

PDF Engines

The PDF Engines module gathers all engines that can manipulate PDF files. It calls each engine until one successfully handles a task. A PDF engine is an external tool that Gotenberg leverages to perform a specific task, such as merging PDF files.

Currently, Gotenberg supports the following PDF engines:

FeatureExifToolPDFtkpdfcpuQPDFUNO
Merge
Split
Flatten
Convert (PDF/A & PDF/UA)
Read metadata
Write metadata
Encrypt
Embed files
Watermark
Stamp
Read bookmarks
Write bookmarks
Rotate
info

PDFtk and QPDF only support the split mode pages with unification.

info

PDFTk’s encryption feature requires both a user password and an owner password, and they must be different.

The encryption strength is limited to AES-128, contrary to other PDF engines (AES-256).

The following flags allow you to configure the PDF Engines module:

FlagEnvironment variableDescriptionDefault
--pdfengines-merge-enginesPDFENGINES_MERGE_ENGINESSet the PDF engines and their order for the merge feature - empty means all.qpdf,pdfcpu,pdftk
--pdfengines-split-enginesPDFENGINES_SPLIT_ENGINESSet the PDF engines and their order for the split feature - empty means all.pdfcpu,qpdf,pdftk
--pdfengines-flatten-enginesPDFENGINES_FLATTEN_ENGINESSet the PDF engines and their order for the flatten feature - empty means all.qpdf
--pdfengines-convert-enginesPDFENGINES_CONVERT_ENGINESSet the PDF engines and their order for the convert feature - empty means all.libreoffice-pdfengine
--pdfengines-read-metadata-enginesPDFENGINES_READ_METADATA_ENGINESSet the PDF engines and their order for the read metadata feature - empty means all.exiftool
--pdfengines-write-metadata-enginesPDFENGINES_WRITE_METADATA_ENGINESSet the PDF engines and their order for the read metadata feature - empty means all.exiftool
--pdfengines-encrypt-enginesPDFENGINES_ENCRYPT_ENGINESSet the PDF engines and their order for the password protection feature - empty means all.qpdf,pdftk,pdfcpu
--pdfengines-embed-enginesPDFENGINES_EMBED_ENGINESSet the PDF engines and their order for the file embedding feature - empty means all.qpdf,pdfcpu
--pdfengines-embed-metadata-enginesPDFENGINES_EMBED_METADATA_ENGINESSet the PDF engines and their order for the embed metadata feature - empty means all.qpdf
--pdfengines-watermark-enginesPDFENGINES_WATERMARK_ENGINESSet the PDF engines and their order for the watermark feature - empty means all.pdfcpu,pdftk
--pdfengines-stamp-enginesPDFENGINES_STAMP_ENGINESSet the PDF engines and their order for the stamp feature - empty means all.pdfcpu,pdftk
--pdfengines-write-bookmarks-enginesPDFENGINES_WRITE_BOOKMARKS_ENGINESSet the PDF engines and their order for the write bookmarks feature - empty means all.pdfcpu,pdftk
--pdfengines-read-bookmarks-enginesPDFENGINES_READ_BOOKMARKS_ENGINESSet the PDF engines and their order for the read bookmarks feature - empty means all.pdfcpu
--pdfengines-rotate-enginesPDFENGINES_ROTATE_ENGINESSet the PDF engines and their order for the rotate feature - empty means all.pdfcpu,pdftk
--pdfengines-disable-routesPDFENGINES_DISABLE_ROUTESDisable the routes.false
warning

As of Gotenberg 8.13.0, the flag --pdfengines-engines has been deprecated.

Webhook

The webhook feature enables Gotenberg to upload the output file originating from multipart/form-data routes to a selected destination.

The following flags allow you to configure the Webhook module:

FlagEnvironment variableDescriptionDefault
--webhook-enable-sync-modeWEBHOOK_ENABLE_SYNC_MODEEnable synchronous mode for the webhook feature.false
--webhook-allow-listWEBHOOK_ALLOW_LISTSet the allowed URLs for the webhook feature using regular expressions. Accepts multiple patterns via comma-separated values or repeated flags.All
--webhook-deny-listWEBHOOK_DENY_LISTSet the denied URLs for the webhook feature using regular expressions. Accepts multiple patterns via comma-separated values or repeated flags.Internal ranges (see below)
--webhook-error-allow-listWEBHOOK_ERROR_ALLOW_LISTDeprecated. Use --webhook-allow-list instead.All
--webhook-error-deny-listWEBHOOK_ERROR_DENY_LISTDeprecated. Use --webhook-deny-list instead.None
--webhook-max-retryWEBHOOK_MAX_RETRYSet the maximum number of retries for the webhook feature.4
--webhook-retry-min-waitWEBHOOK_RETRY_MIN_WAITSet the minimum duration to wait before trying to call the webhook again.1s
--webhook-retry-max-waitWEBHOOK_RETRY_MAX_WAITSet the maximum duration to wait before trying to call the webhook again.30s
--webhook-client-timeoutWEBHOOK_CLIENT_TIMEOUTSet the time limit for requests to the webhook.30s
--webhook-disableWEBHOOK_DISABLEDisable the webhook feature.false
warning

As of Gotenberg 8.31.0, --webhook-error-allow-list has been deprecated in favor of --webhook-allow-list, and --webhook-error-deny-list has been deprecated in favor of --webhook-deny-list. Success and error callbacks now share the same allow/deny rules.

Breaking change

Since Gotenberg 8.31.0, --webhook-deny-list defaults to:

^https?://(10\.|172\.(1[6-9]|2[0-9]|3[01])\.|192\.168\.|169\.254\.|0\.0\.0\.0|127\.|localhost|\[::1\]|\[fd)

It blocks loopback, RFC1918, link-local, and IPv6 unique-local ranges. Gotenberg also resolves each target host and rejects non-public addresses, pinning the dial to the validated IP to prevent DNS rebinding. Set --webhook-allow-list to call internal hosts. See Outbound URL Security.

Prometheus

warning

As of Gotenberg 8.29.0, the Prometheus module is deprecated. Use OpenTelemetry instead, including for migrating from Prometheus.

The Prometheus module collects metrics from other modules and exposes an HTTP endpoint that can be scraped by Prometheus.

The following flags allow you to configure the Prometheus module:

FlagEnvironment variableDescriptionDefault
--prometheus-metrics-pathPROMETHEUS_METRICS_PATHSet the metrics endpoint path./prometheus/metrics
--prometheus-collect-intervalPROMETHEUS_COLLECT_INTERVALSet the interval for collecting modules' metrics.1s
--prometheus-namespacePROMETHEUS_NAMESPACESet the namespace of modules' metrics.gotenberg
--prometheus-disable-collectPROMETHEUS_DISABLE_COLLECTDisable the collect of metrics.false
--prometheus-disable-route-telemetryPROMETHEUS_DISABLE_ROUTE_TELEMETRYDisable telemetry for the Prometheus metrics route.true
warning

As of Gotenberg 8.29.0, --prometheus-disable-route-logging has been deprecated in favor of --prometheus-disable-route-telemetry.

Logging

Gotenberg uses slog-based structured logging. For exporting logs via OpenTelemetry, see Telemetry.

The following flags control stdout log output:

FlagEnvironment variableDescriptionDefault
--log-std-formatLOG_STD_FORMATSpecify the format of logging. Options include auto, json, or text.auto
--log-levelLOG_LEVELChoose the level of logging detail. Options include error, warn, info, or debug.info
--log-fields-prefixLOG_FIELDS_PREFIXPrepend a specified prefix to each field in the logs.None
--log-std-enable-gcp-fieldsLOG_STD_ENABLE_GCP_FIELDSEnable Google Cloud Platform fields: time, message, severity.false
warning

As of Gotenberg 8.19.0, --log-enable-gcp-severity has been deprecated in favor of --log-enable-gcp-fields.

As of Gotenberg 8.29.0, --log-format has been deprecated in favor of --log-std-format, and --log-enable-gcp-fields has been deprecated in favor of --log-std-enable-gcp-fields.

Graceful Shutdown

To ensure running tasks have enough time to complete, Gotenberg waits for a specific duration before initiating the shutdown process.

The following flag allows you to configure this duration:

FlagEnvironment variableDescriptionDefault
--gotenberg-graceful-shutdown-durationGOTENBERG_GRACEFUL_SHUTDOWN_DURATIONSet the graceful shutdown duration.30s
info

For Gotenberg versions prior to 8.21.0, when using the webhook feature, make sure this duration is equal to or longer than the API timeout. This ensures that all asynchronous processes finish before Gotenberg begins its shutdown sequence.

Hide Banner

The following flag allows you to hide the startup banner with:

FlagEnvironment variableDescriptionDefault
--gotenberg-hide-bannerGOTENBERG_HIDE_BANNERHide the banner.false

Docker Image

The examples below use the full image (gotenberg/gotenberg:8). Replace the base image tag to match your variant (:8-chromium, :8-libreoffice). See the installation guide for available variants and their capabilities.

Fonts

Since 8.30.0, the font stack has been simplified from 30+ packages down to 8, covering Latin, Greek, Cyrillic, CJK, and most world scripts through Noto, plus color emoji.

PackageCoverage
fonts-noto-coreArabic, Bengali, Devanagari, Ethiopic, Georgian, Gujarati, Gurmukhi, Hebrew, Kannada, Khmer, Lao, Malayalam, Myanmar, Sinhala, Tamil, Telugu, Thai, and more
fonts-noto-cjkChinese, Japanese, Korean
fonts-noto-color-emojiColor emoji
fonts-dejavuLatin, Greek, Cyrillic
fonts-crosextra-carlitoMetric-compatible with Calibri
fonts-crosextra-caladeaMetric-compatible with Cambria
fonts-liberationMetric-compatible with Arial, Times New Roman, Courier New
fonts-liberation2Updated Liberation metrics

Microsoft Core Fonts (ttf-mscorefonts-installer) are not shipped due to licensing constraints. The image includes metric-compatible replacements instead: Carlito for Calibri, Caladea for Cambria, and Liberation for Arial, Times New Roman, and Courier New. These preserve document layout in most cases.

Installing Additional Fonts

Build a custom Dockerfile to add fonts. Three common scenarios:

Microsoft Core Fonts (you accept the Microsoft EULA):

FROM gotenberg/gotenberg:8

USER root

RUN echo "deb http://deb.debian.org/debian trixie contrib non-free" \
> /etc/apt/sources.list.d/contrib.list \
&& echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" \
| debconf-set-selections \
&& apt-get update -qq \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends \
ca-certificates \
wget \
ttf-mscorefonts-installer \
&& rm -rf /var/lib/apt/lists/*

USER gotenberg

Specialized script fonts for richer glyph sets, better hinting, or traditional typefaces beyond the basic Noto coverage:

ScriptPackage
Arabic (Naskh)fonts-hosny-amiri
Bengalifonts-beng
Devanagari (Hindi)fonts-sarai
Ethiopicfonts-sil-abyssinica
Gujaratifonts-samyak-gujr
Gurmukhi (Punjabi)fonts-lohit-guru
Hebrewculmus
Kannadafonts-lohit-knda
Malayalamfonts-samyak-mlym
Myanmarfonts-sil-padauk
Sinhalafonts-lklug-sinhala
Tamilfonts-samyak-taml
Telugufonts-telu
Thaifonts-thai-tlwg
FROM gotenberg/gotenberg:8

USER root

RUN apt-get update -qq \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends \
fonts-hosny-amiri \
fonts-thai-tlwg \
&& rm -rf /var/lib/apt/lists/*

USER gotenberg

Custom .ttf files from your own collection:

FROM gotenberg/gotenberg:8

USER root

COPY /local/path/to/fonts/* /usr/local/share/fonts/

USER gotenberg

Alternatively, mount a volume to /usr/local/share/fonts/ at runtime as described in this comment.

Ownership

The Docker image employs a specific non-root user, named gotenberg, with a User ID (uid) and Group ID (gid) of 1001. If you want to change these identifiers, you will have to build a custom Docker image:

FROM gotenberg/gotenberg:8

USER root

RUN usermod -u {uid} -g {gid} gotenberg

USER gotenberg
info

Since Gotenberg 8.21.0, the image also supports arbitrary user IDs (OpenShift).

Template Repository

Gotenberg comes with a template repository that you can use to quickly bootstrap your own variant:

Sponsors
TheCodingMachinepdfmePdfBolt
Powered by
DockerJetBrains