Using Docker with SymfonyEdit this page
Can you use Docker with Symfony? Of course! And several tools exist to help, depending on your needs.
If you'd like a complete Docker environment (i.e. where PHP, web server, database, etc. are all in Docker), check out https://github.com/dunglas/symfony-docker.
The Flex recipe for some packages also include Docker configuration.
For example, when you run
composer require doctrine (to get
docker-compose.yml file will automatically be updated to include a
The first time you install a recipe containing Docker config, Flex will ask you
if you want to include it. Or, you can set your preference in
by setting the
symfony.extra.docker config to
Some recipes also include additions to your
Dockerfile. To get those changes,
you need to already have a
Dockerfile at the root of your app with the
following code somewhere inside:
###> recipes ### ###
The recipe will find this section and add the changes inside. If you're using https://github.com/dunglas/symfony-docker, you'll already have this.
After installing the package, rebuild your containers by running:
$ docker-compose up --build