Environment Variable Specifications
We like to customize our images on a per app basis using environment variables. Look below to see what variables are available and what their defaults are. You can easily override them in your own docker environments (see Docker's documentation).
Variable Name | Description | Used in variation |
---|---|---|
APACHE_DOCUMENT_ROOT Default: "/var/www/html/public" | Sets the directory from which Apache will serve files. (Official docs) | fpm-apache |
APACHE_MAX_CONNECTIONS_PER_CHILD Default: "0" | Sets the limit on the number of connections that an individual child server process will handle.(Official docs) | fpm-apache |
APACHE_MAX_REQUEST_WORKERS Default: "150" | Sets the limit on the number of simultaneous requests that will be served. (Official docs) | fpm-apache |
APACHE_MAX_SPARE_THREADS Default: "75" | Maximum number of idle threads. (Official docs) | fpm-apache |
APACHE_MIN_SPARE_THREADS Default: "10" | Minimum number of idle threads to handle request spikes. (Official docs) | fpm-apache |
APACHE_RUN_GROUP Default: "www-data" | Set the username of what Apache should run as. | fpm-apache |
APACHE_RUN_USER Default: "www-data" | Set the username of what Apache should run as. | fpm-apache |
APACHE_START_SERVERS Default: "2" | Sets the number of child server processes created on startup.(Official docs) | fpm-apache |
APACHE_THREAD_LIMIT Default: "64" | Set the maximum configured value for ThreadsPerChild for the lifetime of the Apache httpd process. (Official docs) | fpm-apache |
APACHE_THREADS_PER_CHILD Default: "25" | This directive sets the number of threads created by each child process. (Official docs) | fpm-apache |
APP_BASE_DIR Default: "/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_ENABLED Default: "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_CONFIG_CACHE Default: "true" | Automatically run "php artisan config:cache" on container start. ℹ️ Requires AUTORUN_ENABLED = true to run. | all |
AUTORUN_LARAVEL_EVENT_CACHE Default: "true" | Automatically run "php artisan event:cache" on container start. ℹ️ Requires AUTORUN_ENABLED = true to run. | all |
AUTORUN_LARAVEL_MIGRATION Default: "true" | Automatically run php artisan migrate --force on container start. ℹ️ Requires AUTORUN_ENABLED = true to run. | all |
AUTORUN_LARAVEL_MIGRATION_ISOLATION Default: "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. | all |
AUTORUN_LARAVEL_MIGRATION_TIMEOUT Default: "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_CACHE Default: "true" | Automatically run "php artisan route:cache" on container start. ℹ️ Requires AUTORUN_ENABLED = true to run. | all |
AUTORUN_LARAVEL_STORAGE_LINK Default: "true" | Automatically run "php artisan storage:link" on container start. ℹ️ Requires AUTORUN_ENABLED = true to run. | all |
AUTORUN_LARAVEL_VIEW_CACHE Default: "true" | Automatically run "php artisan view:cache" on container start. ℹ️ Requires AUTORUN_ENABLED = true to run. | all |
COMPOSER_ALLOW_SUPERUSER Default: "1" | Disable warning about running as super-user | all |
COMPOSER_HOME Default: "/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_HTTP Default: "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_CONFIG Default: "false" | Get full customization of the image and disable all default configurations and automations. | all |
HEALTHCHECK_PATH Default: "/healthcheck" | Set the path for the health check endpoint. (Official docs) | all (except cli ) |
LOG_OUTPUT_LEVEL Default: "warn" | Set your container output different verbosity levels: debug, info, off | all |
NGINX_FASTCGI_BUFFERS Default: "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_SIZE Default: "8k" | Sets the size of the buffer used for reading a response from a FastCGI server. (Official Docs) | fpm-nginx |
NGINX_SERVER_TOKENS Default: "off" | Display NGINX version in responses. (Official Docs) | fpm-nginx |
NGINX_WEBROOT Default: "`/var/www/html/public" | Sets the root directory for requests. (Official Docs) | fpm-nginx |
PHP_DATE_TIMEZONE Default: "UTC" | Control your timezone. (Official Docs) | all |
PHP_DISPLAY_ERRORS Default: Off | Show PHP errors on screen. (Official docs) | all |
PHP_DISPLAY_STARTUP_ERRORS Default: Off | Even when display_errors is on, errors that occur during PHP's startup sequence are not displayed. (Official docs) | all |
PHP_ERROR_LOG Default: "/dev/stderr" | Name of the file where script errors should be logged. . (Official docs) | all |
PHP_ERROR_REPORTING Default: "22527" | Set PHP error reporting level. Must be a number. Use this tool for help. (Official docs) | all |
PHP_FPM_PM_CONTROL Defaults: 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_CHILDREN Default: "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_SPARE_SERVERS Default: "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_SERVERS Default: "1" | The desired minimum number of idle server processes. Used only when pm is set to dynamic. (Official docs) | fpm* |
PHP_FPM_PM_START_SERVERS Default: "2" | The number of child processes created on startup. Used only when pm is set to dynamic. (Official docs) | fpm* |
PHP_FPM_POOL_NAME Default: "www" | Set the name of your PHP-FPM pool (helpful when running multiple sites on a single server). | fpm* |
PHP_FPM_PROCESS_CONTROL_TIMEOUT Default: "10s" | Set the timeout for the process control commands. (Official docs) | fpm* |
PHP_MAX_EXECUTION_TIME Default: "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_TIME Default: "-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_MEMORY_LIMIT Default: "256M" | Set the maximum amount of memory in bytes that a script is allowed to allocate. (Official docs) | all |
PHP_OPCACHE_ENABLE Default: "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_INTERNED_STRINGS_BUFFER Default: "8" | The amount of memory used to store interned strings, in megabytes. (Official docs) | all |
PHP_OPCACHE_MAX_ACCELERATED_FILES Default: "10000" | The maximum number of keys (scripts) in the OPcache hash table. (Official docs) | all |
PHP_OPCACHE_MEMORY_CONSUMPTION Default: "128" | The amount of memory used by the OPcache engine, in megabytes. (Official docs) | all |
PHP_OPCACHE_REVALIDATE_FREQ Default: "2" | How often the OPcache checks for updates to cached files (in seconds). (Official docs) | all |
PHP_OPEN_BASEDIR Default: "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_SIZE Default: "100M" | Sets max size of post data allowed. (Official docs) | all |
PHP_SESSION_COOKIE_SECURE Default: 1 (true) | Specifies whether cookies should only be sent over secure connections. (Official docs) | all |
PHP_UPLOAD_MAX_FILE_SIZE Default: "100M" | The maximum size of an uploaded file. (Official docs) | all |
S6_BEHAVIOUR_IF_STAGE2_FAILS Default: "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_MAXTIME Default: "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_VERBOSITY Default: "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_MESSAGE Default: "true" | Show a helpful welcome message showing container information when the container starts. | all |
SSL_CERTIFICATE_FILE Default: "/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_MODE Default: "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_FILE Default: "/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 |
UNIT_CERTIFICATE_NAME Default: "self-signed-web-bundle" | Name of your certificate bundle. This is used to configure HTTPS. (Official Docs) | unit |
UNIT_CONFIG_DIRECTORY Default: "/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_FILE Default: "/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_TIMEOUT Default: "30" | The maximum time in seconds that an idle process will be kept alive. (Official Docs) | unit |
UNIT_PROCESSES_MAX Default: "20" | The maximum number of application processes that can be started. (Official Docs) | unit |
UNIT_PROCESSES_SPARE Default: "2" | Minimum number of idle processes that Unit tries to maintain for an app. (Official Docs) | unit |
UNIT_WEBROOT Default: "/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_SIZE Default: "104857600" (100MB) | Sets maximum number of bytes in the body of a client’s request. (Official docs) | unit |