Skip to content

Commit 7988548

Browse files
committed
minor #14587 Add a note about exposing env vars for unrecognized Docker services (fabpot)
This PR was merged into the 4.4 branch. Discussion ---------- Add a note about exposing env vars for unrecognized Docker services This one should be merged when Symfony CLI 4.21 is released. <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/releases for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `5.x` for features of unreleased versions). --> Commits ------- 1aabce3 Add a note about exposing env vars for unrecognized Docker services
2 parents 4a896f8 + 1aabce3 commit 7988548

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

setup/symfony_server.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,9 @@ project. It understands that this is a MySQL service and creates environment
299299
variables accordingly with the service name (``database``) as a prefix:
300300
``DATABASE_URL``, ``DATABASE_HOST``, ...
301301

302+
If the service is not in the supported list below, generic environment
303+
variables are set: ``PORT``, ``IP``, and ``HOST``.
304+
302305
If the ``docker-compose.yaml`` names do not match Symfony's conventions, add a
303306
label to override the environment variables prefix:
304307

@@ -361,6 +364,20 @@ When Docker services are running, browse a page of your Symfony application and
361364
check the "Symfony Server" section in the web debug toolbar; you'll see that
362365
"Docker Compose" is "Up".
363366

367+
.. note::
368+
369+
If you don't want environment variables to be exposed for a service, set
370+
the ``com.symfony.server.service-ignore`` label to ``true``:
371+
372+
.. code-block:: yaml
373+
374+
# docker-compose.yaml
375+
services:
376+
db:
377+
ports: [3306]
378+
labels:
379+
com.symfony.server.service-ignore: true
380+
364381
If your Docker Compose file is not at the root of the project, use the
365382
``COMPOSE_FILE`` and ``COMPOSE_PROJECT_NAME`` environment variables to define
366383
its location, same as for ``docker-compose``:

0 commit comments

Comments
 (0)