Reference
Environment Variable Specification
Environment variables are a very powerful way to customize your container. Use the document below to see what options are available to customize without requiring you to mount any custom configuration files.
Setting environment variables all depends on what method you're using to run your container, but for most cases you might be using Docker Compose.
Learn environment variables work with Docker ComposeAvailable Environment Variables
| Variable Name | Description | Used in variation |
|---|---|---|
APACHE_DOCUMENT_ROOTDefault: "/var/www/html/public" | Sets the directory from which Apache will serve files. (Official docs) | fpm-apache |
APACHE_HTTP_PORTDefault: "8080" | Set the port for HTTP. (Official docs) | fpm-apache |
APACHE_HTTPS_PORTDefault: "8443" | Set the port for HTTPS. (Official docs) | fpm-apache |
APACHE_MAX_CONNECTIONS_PER_CHILDDefault: "0" | Sets the limit on the number of connections that an individual child server process will handle.(Official docs) | fpm-apache |
APACHE_MAX_REQUEST_WORKERSDefault: "150" | Sets the limit on the number of simultaneous requests that will be served. (Official docs) | fpm-apache |
APACHE_MAX_SPARE_THREADSDefault: "75" | Maximum number of idle threads. (Official docs) | fpm-apache |
APACHE_MIN_SPARE_THREADSDefault: "10" | Minimum number of idle threads to handle request spikes. (Official docs) | fpm-apache |
APACHE_RUN_GROUPDefault: "www-data" | Set the username of what Apache should run as. | fpm-apache |
APACHE_RUN_USERDefault: "www-data" | Set the username of what Apache should run as. | fpm-apache |
APACHE_START_SERVERSDefault: "2" | Sets the number of child server processes created on startup.(Official docs) | fpm-apache |
APACHE_THREAD_LIMITDefault: "64" | Set the maximum configured value for ThreadsPerChild for the lifetime of the Apache httpd process. (Official docs) | fpm-apache |
APACHE_THREADS_PER_CHILDDefault: "25" | This directive sets the number of threads created by each child process. (Official docs) | fpm-apache |
APP_BASE_DIRDefault: "/var/www/html" | Change this only if you mount your application to a different directory within the container. ℹ️ Be sure to change NGINX_WEBROOT, APACHE_DOCUMENT_ROOT, UNIT_WEBROOT, etc if it applies to your use case as well. | all |
AUTORUN_DEBUGDefault: "false" | Enable debug mode for the Laravel automations. | all |
AUTORUN_ENABLEDDefault: "false" | Enable or disable all automations. It's advised to set this to false in certain CI environments (especially during a composer install). If this is set to false, all AUTORUN_* behaviors will also be disabled. | all |
AUTORUN_LARAVEL_OPTIMIZEDefault: "true" | Automatically run "php artisan optimize" on container, attempting to --except in Laravel > v11.38.0 (Official docs) ℹ️ Requires AUTORUN_ENABLED = true to run. | all |
AUTORUN_LARAVEL_CONFIG_CACHEDefault: "true" | Automatically run "php artisan config:cache" on container start. ℹ️ Requires AUTORUN_ENABLED = true to run. | all |
AUTORUN_LARAVEL_EVENT_CACHEDefault: "true" | Automatically run "php artisan event:cache" on container start. ℹ️ Requires AUTORUN_ENABLED = true to run. | all |
AUTORUN_LARAVEL_MIGRATIONDefault: "true" | Automatically run php artisan migrate --force on container start. ℹ️ Requires AUTORUN_ENABLED = true to run. | all |
AUTORUN_LARAVEL_MIGRATION_DATABASEDefault: null | Run migrations on a specific database. In the rare case you need to use multiple databases, you can provide a comma-delimited list of connection names (e.g., "mysql,pgsql"). If null, it will use the default database connection. ℹ️ Requires AUTORUN_ENABLED = true to run. | all |
AUTORUN_LARAVEL_MIGRATION_FORCEDefault: "true" | Force migrations to run in production without confirmation. Set to false to disable the --force flag. ℹ️ Requires AUTORUN_ENABLED = true to run. | all |
AUTORUN_LARAVEL_MIGRATION_ISOLATIONDefault: "false" | Requires Laravel v9.38.0 or higher and a database that supports table locks. Automatically run php artisan migrate --force --isolated on container start. ℹ️ Requires AUTORUN_ENABLED = true to run.ℹ️ Does not work with SQLite. ℹ️ Only works with AUTORUN_LARAVEL_MIGRATION_MODE = default. | all |
AUTORUN_LARAVEL_MIGRATION_MODEDefault: "default" | Set the migration mode. Valid options: default (runs php artisan migrate), fresh (runs php artisan migrate:fresh), or refresh (runs php artisan migrate:refresh). ℹ️ Requires AUTORUN_ENABLED = true to run.⚠️ WARNING: fresh and refresh are destructive and will drop all tables. Only use these in development or testing environments. | all |
AUTORUN_LARAVEL_MIGRATION_SEEDDefault: "false" | Automatically seed the database after migrations by adding the --seed flag. ℹ️ Requires AUTORUN_ENABLED = true to run. | all |
AUTORUN_LARAVEL_MIGRATION_SKIP_DB_CHECKDefault: "false" | Skip the database connection check before running migrations. ℹ️ Requires AUTORUN_ENABLED = true to run. | all |
AUTORUN_LARAVEL_MIGRATION_TIMEOUTDefault: "30" | The number of seconds to wait for the database to come online before attempting php artisan migrate.. ℹ️ Requires AUTORUN_ENABLED = true to run. | all |
AUTORUN_LARAVEL_ROUTE_CACHEDefault: "true" | Automatically run "php artisan route:cache" on container start. ℹ️ Requires AUTORUN_ENABLED = true to run. | all |
AUTORUN_LARAVEL_STORAGE_LINKDefault: "true" | Automatically run "php artisan storage:link" on container start. ℹ️ Requires AUTORUN_ENABLED = true to run. | all |
AUTORUN_LARAVEL_VIEW_CACHEDefault: "true" | Automatically run "php artisan view:cache" on container start. ℹ️ Requires AUTORUN_ENABLED = true to run. | all |
CADDY_ADMINDefault: "off" | Enable Caddy admin interface. (Official docs) | frankenphp |
CADDY_AUTO_HTTPSDefault: "off" | Enable automatic HTTPS. (Official docs) | frankenphp |
CADDY_GLOBAL_OPTIONSDefault: "" | Set global options for the Caddy server. (Official docs) | frankenphp |
CADDY_HTTP_PORTDefault: "8080" | Set the port for HTTP. (Official docs) | frankenphp |
CADDY_HTTP_SERVER_ADDRESSDefault: "http://" | Set the server address for HTTP. (Official docs) | frankenphp |
CADDY_HTTPS_PORTDefault: "8443" | Set the port for HTTPS. (Official docs) | frankenphp |
CADDY_HTTPS_SERVER_ADDRESSDefault: "https://" | Set the server address for HTTPS. (Official docs) | frankenphp |
CADDY_LOG_FORMATDefault: "console" | Set the format for the Caddy log. (Official docs) | frankenphp |
CADDY_LOG_OUTPUTDefault: "stdout" | Set the output for the Caddy log. (Official docs) | frankenphp |
CADDY_PHP_SERVER_OPTIONSDefault: "" | Set PHP server options for the Caddy server. (Official docs) | frankenphp |
CADDY_SERVER_EXTRA_DIRECTIVESDefault: "" | Set extra directives for the Caddy server. (Official docs) | frankenphp |
CADDY_SERVER_LOG_LEVELDefault: "warn" | Set the server log level for the Caddy server. This can also be changed with LOG_OUTPUT_LEVEL, but CADDY_SERVER_LOG_LEVEL takes precedence. (Official docs) | frankenphp |
CADDY_SERVER_ROOTDefault: "/var/www/html/public" | Set the root directory for the Caddy server. (Official docs) | frankenphp |
COMPOSER_ALLOW_SUPERUSERDefault: "1" | Disable warning about running as super-user | all |
COMPOSER_HOMEDefault: "/composer" | The COMPOSER_HOME variable allows you to change the Composer home directory. This is a hidden, global (per-user on the machine) directory that is shared between all projects. | all |
COMPOSER_MAX_PARALLEL_HTTPDefault: "24" | Set to an integer to configure how many files can be downloaded in parallel. Composer ships with 12 by default and must be between 1 and 50. If your proxy has issues with concurrency maybe you want to lower this. Increasing it should generally not result in performance gains. | all |
DISABLE_DEFAULT_CONFIGDefault: "false" | Get full customization of the image and disable all default configurations and automations. | all |
FRANKENPHP_CONFIGDefault: "" | Set the configuration for FrankenPHP. (Official docs) | frankenphp |
HEALTHCHECK_PATHDefault: "/healthcheck" | Set the path for the health check endpoint. (Official docs) | all (except cli and frankenphp) |
HEALTHCHECK_SSL_CERTIFICATE_FILEDefault: "/etc/ssl/healthcheck/localhost.crt" | Set the path to the SSL certificate for the health check endpoint. | fpm-apache, fpm-nginx, frankenphp |
HEALTHCHECK_SSL_PRIVATE_KEY_FILEDefault: "/etc/ssl/healthcheck/localhost.key" | Set the path to the SSL private key for the health check endpoint. | fpm-apache, fpm-nginx, frankenphp |
LOG_OUTPUT_LEVELDefault: "warn" (for all) "info" (for frankenphp) | Set your container output different verbosity levels: debug, warn, info, off | all |
NGINX_ACCESS_LOGDefault: "/dev/stdout" | Set the default output stream for access log. | fpm-nginx |
NGINX_ERROR_LOGDefault: "/dev/stderr" | Set the default output stream for error log. | fpm-nginx |
NGINX_FASTCGI_BUFFERSDefault: "8 8k" | Sets the number and size of the buffers used for reading a response from a FastCGI server. (Official Docs) | fpm-nginx |
NGINX_FASTCGI_BUFFER_SIZEDefault: "8k" | Sets the size of the buffer used for reading a response from a FastCGI server. (Official Docs) | fpm-nginx |
NGINX_LISTEN_IP_PROTOCOLDefault: "all" | Set the IP protocol for NGINX to listen on. Valid values are "all", "ipv4", and "ipv6". (Official Docs) | fpm-nginx |
NGINX_SERVER_TOKENSDefault: "off" | Display NGINX version in responses. (Official Docs) | fpm-nginx |
NGINX_WEBROOTDefault: "`/var/www/html/public" | Sets the root directory for requests. (Official Docs) | fpm-nginx |
NGINX_CLIENT_MAX_BODY_SIZEDefault: "100M" | Sets the max body size for requests. (Official Docs</a) | fpm-nginx |
PHP_DATE_TIMEZONEDefault: "UTC" | Control your timezone. (Official Docs) | all |
PHP_DISPLAY_ERRORSDefault: Off | Show PHP errors on screen. (Official docs) | all |
PHP_DISPLAY_STARTUP_ERRORSDefault: Off | Even when display_errors is on, errors that occur during PHP's startup sequence are not displayed. (Official docs) | all |
PHP_ERROR_LOGDefault: "/dev/stderr" | Name of the file where script errors should be logged. . (Official docs) | all |
PHP_ERROR_REPORTINGDefault: "22527" | Set PHP error reporting level. Must be a number. Use this tool for help. (Official docs) | all |
PHP_FPM_CHILD_PROCESS_USERDefault: "www-data" | ⚠️ Only used if container is running as root. Set the user of the PHP-FPM child processes. (Official docs) | fpm* |
PHP_FPM_CHILD_PROCESS_GROUPDefault: "www-data" | ⚠️ Only used if container is running as root. Set the group of the PHP-FPM child processes. (Official docs) | fpm* |
PHP_FPM_PM_CONTROLDefaults: fpm: dynamic fpm-apache: ondemand fpm-nginx: ondemand | Choose how the process manager will control the number of child processes. (Official docs) | fpm* |
PHP_FPM_PM_MAX_CHILDRENDefault: "20" | The number of child processes to be created when pm is set to static and the maximum number of child processes to be created when pm is set to dynamic. (Official docs) | fpm* |
PHP_FPM_PM_MAX_REQUESTSDefault: "0" | The number of requests each child process should execute before respawning. This can be useful to work around memory leaks in 3rd party libraries. (Official docs) | fpm* |
PHP_FPM_PM_MAX_SPARE_SERVERSDefault: "3" | The desired maximum number of idle server processes. Used only when pm is set to dynamic. (Official docs) | fpm* |
PHP_FPM_PM_MIN_SPARE_SERVERSDefault: "1" | The desired minimum number of idle server processes. Used only when pm is set to dynamic. (Official docs) | fpm* |
PHP_FPM_PM_START_SERVERSDefault: "2" | The number of child processes created on startup. Used only when pm is set to dynamic. (Official docs) | fpm* |
PHP_FPM_PM_STATUS_PATHDefault: "" | The path to the PHP-FPM status page. (Official docs) | fpm* |
PHP_FPM_POOL_NAMEDefault: "www" | Set the name of your PHP-FPM pool (helpful when running multiple sites on a single server). | fpm* |
PHP_FPM_PROCESS_CONTROL_TIMEOUTDefault: "10s" | Set the timeout for the process control commands. (Official docs) | fpm* |
PHP_MAX_EXECUTION_TIMEDefault: "99" | Set the maximum time in seconds a script is allowed to run before it is terminated by the parser. (Official docs) | all |
PHP_MAX_INPUT_TIMEDefault: "-1" | This sets the maximum time in seconds a script is allowed to parse input data, like POST and GET. Timing begins at the moment PHP is invoked at the server and ends when execution begins. The default setting is -1, which means that max_execution_time is used instead. Set to 0 to allow unlimited time. This directive is hardcoded to -1 for the CLI SAPI by PHP. (Official docs) | all |
PHP_MAX_INPUT_VARSDefault: "1000" | Set the limits for number of input variables (e.g., POST, GET, or COOKIE variables) that PHP will process in a single request. (Official docs) | all |
PHP_MEMORY_LIMITDefault: "256M" | Set the maximum amount of memory in bytes that a script is allowed to allocate. (Official docs) | all |
PHP_OPCACHE_ENABLEDefault: "0" (to keep developers sane) | Enable or disable OPcache. ⚠️ This will set both values for opcache.enable and opcache.enable_cli. (Official docs) | all |
PHP_OPCACHE_ENABLE_FILE_OVERRIDEDefault: "0" | Enable or disable file existence override (file_exists, etc.). (Official docs) | all |
PHP_OPCACHE_FORCE_RESTART_TIMEOUTDefault: "180" | The number of seconds to wait for a scheduled restart to begin if the cache isn't active, in seconds. If the timeout is hit, then OPcache assumes that something is wrong and will kill the processes holding locks on the cache to permit a restart. (Official docs) | all |
PHP_OPCACHE_INTERNED_STRINGS_BUFFERDefault: "8" | The amount of memory used to store interned strings, in megabytes. (Official docs) | all |
PHP_OPCACHE_JITDefault: "off" | Enable or disable the JIT compiler. (Official docs) | all |
PHP_OPCACHE_JIT_BUFFER_SIZEDefault: "0" | The amount of shared memory to reserve for compiled JIT code. A zero value disables the JIT. (Official docs) | all |
PHP_OPCACHE_MAX_ACCELERATED_FILESDefault: "10000" | The maximum number of keys (scripts) in the OPcache hash table. (Official docs) | all |
PHP_OPCACHE_MEMORY_CONSUMPTIONDefault: "128" | The amount of memory used by the OPcache engine, in megabytes. (Official docs) | all |
PHP_OPCACHE_REVALIDATE_FREQDefault: "2" | How often the OPcache checks for updates to cached files (in seconds). (Official docs) | all |
PHP_OPCACHE_SAVE_COMMENTSDefault: "1" | Remove comments from OPcache to minify a bit further. Note: any code that depends on PHPDoc annotations can break from this. (Official docs) | all |
PHP_OPCACHE_VALIDATE_TIMESTAMPSDefault: "1" | Whether OPcache checks for changes to files, or requires reload of PHP to revalidate OPcache. (Official docs) | all |
PHP_OPEN_BASEDIRDefault: "None" | Limit the files that can be accessed by PHP to the specified directory-tree, including the file itself. open_basedir is just an extra safety net, that is in no way comprehensive, and can therefore not be relied upon when security is needed. (Official docs) | all |
PHP_POST_MAX_SIZEDefault: "100M" | Sets max size of post data allowed. (Official docs) | all |
PHP_REALPATH_CACHE_TTLDefault: "120" | The duration of time, in seconds for which to cache realpath information for a given file or directory. (Official docs) | all |
PHP_SESSION_COOKIE_SECUREDefault: 1 (true) | Specifies whether cookies should only be sent over secure connections. (Official docs) | all |
PHP_UPLOAD_MAX_FILE_SIZEDefault: "100M" | The maximum size of an uploaded file. (Official docs) | all |
PHP_ZEND_DETECT_UNICODEDefault: "" | Check for BOM (Byte Order Mark) and see if the file contains valid multibyte characters. This detection is performed before processing of __halt_compiler(). Available only in Zend Multibyte mode. (Official docs) | all |
PHP_ZEND_MULTIBYTEDefault: "Off" | Enable or disable Zend Multibyte. (Official docs) | all |
S6_BEHAVIOUR_IF_STAGE2_FAILSDefault: "2" (stop the container) | Determines what the container should do if one of the service scripts fails (Official docs) | fpm-nginx, fpm-apache |
S6_CMD_WAIT_FOR_SERVICES_MAXTIMEDefault: "0" | The maximum time (in milliseconds) the services could take to bring up before proceeding to CMD executing (Official docs) | fpm-nginx, fpm-apache |
S6_VERBOSITYDefault: "1" | Set the verbosity of "S6 Overlay" (the init system these images are based on). The default is "1" (print warnings and errors). The scale goes from 1 to 5, but the output will quickly become very noisy. If you're having issues, start here. You can also customize many other variables. (Official docs) | fpm-nginx, fpm-apache |
SHOW_WELCOME_MESSAGEDefault: "true" | Show a helpful welcome message showing container information when the container starts. | all |
SSL_CERTIFICATE_FILEDefault: "/etc/ssl/private/self-signed-web.crt" | Path to public certificate file for HTTPS. You must provide this file otherwise a self-signed key pair will be generated for you. | fpm-nginx, fpm-apache |
SSL_MODEDefault: "off" | Configure how you would like to handle SSL. This can be "off" (HTTP only), "mixed" (HTTP + HTTPS), or "full" (HTTPS only). If you use HTTP, you may need to also change PHP_SESSION_COOKIE_SECURE. | fpm-nginx, fpm-apache, unit |
SSL_PRIVATE_KEY_FILEDefault: "/etc/ssl/private/self-signed-web.key" | Path to private key file for HTTPS. You must provide this file otherwise a self-signed key pair will be generated for you. | fpm-nginx, fpm-apache, frankenphp |
UNIT_CERTIFICATE_NAMEDefault: "self-signed-web-bundle" | Name of your certificate bundle. This is used to configure HTTPS. (Official Docs) | unit |
UNIT_CONFIG_DIRECTORYDefault: "/etc/unit/config.d" | Path to the Unit configuration directory. Any *.json, *.js, and *.pem files will be loaded into Unit on initialization. | unit |
UNIT_CONFIG_FILEDefault: "/etc/unit/config.d/config.json" | Path to the Unit configuration file. One will be generated automatically by default. (Official Docs) | unit |
UNIT_PROCESSES_IDLE_TIMEOUTDefault: "30" | The maximum time in seconds that an idle process will be kept alive. (Official Docs) | unit |
UNIT_PROCESSES_MAXDefault: "20" | The maximum number of application processes that can be started. (Official Docs) | unit |
UNIT_PROCESSES_SPAREDefault: "2" | Minimum number of idle processes that Unit tries to maintain for an app. (Official Docs) | unit |
UNIT_WEBROOTDefault: "/var/www/html/public" | Base directory of the app’s file structure. All URI paths are relative to it. (Official Docs) | unit |
UNIT_MAX_BODY_SIZEDefault: "104857600" (100MB) | Sets maximum number of bytes in the body of a client’s request. (Official docs) | unit |