It's also possible to use Symfony Docker with existing projects!
First, download this skeleton.
If you cloned the Git repository, be sure to not copy the .git directory
to prevent conflicts with the .git directory already in your existing project.
You can copy the contents of the repository using Git and tar.
This will not contain .git or any uncommited changes.
git archive --format=tar HEAD | tar -xC my-existing-project/If you downloaded the skeleton as a ZIP you can just copy the extracted files:
cp -Rp symfony-docker/. my-existing-project/Enable the Docker support of Symfony Flex:
composer config --json extra.symfony.docker 'true'The worker mode of FrankenPHP is enabled by default. To use it with Symfony ≤ 7.3, install the FrankenPHP runtime:
composer require runtime/frankenphp-symfonyThen update worker configuration:
worker {
file ./public/index.php
+ env APP_RUNTIME Runtime\FrankenPhpSymfony\Runtime
{$FRANKENPHP_WORKER_CONFIG}
}Tip
You can disable worker mode by removing the worker directive from the frankenphp
global option in your Caddyfile.
Re-execute the recipes to update the Docker-related files according to the packages you use:
rm symfony.lock
composer recipes:install --force --verboseDouble-check the changes, revert the changes that you don't want to keep:
git diffBuild the Docker images:
docker compose build --pull --no-cacheStart the project!
docker compose up --waitBrowse https://localhost, your Docker configuration is ready!