v2.1 Using API Platform with Docker

Using API Platform with Docker

API Platform projects can be run through Docker. A Docker compose configuration, including a fully working LAMP stack, is shipped with the API Platform distribution.

Services

The Docker Compose configuration comes with several ready-to-use services by default:

NameDescriptionPort(s)
appThe application with PHP and PHP-FPM 7.1, the latest ComposerN/A
dbA database provided by MySQL 5.7N/A
nginxAn HTTP server provided by Nginx 1.118080
varnishAn HTTP cache provided by Varnish 4.180

Installation

To install it, run the following commands (Docker must be installed on your system):

$ docker-compose up -d # Download, build and run Docker images
$ docker-compose exec app bin/console doctrine:schema:create # Create the MySQL schema

Your project will be accessible in two different ways:

  • Through the HTTP cache (Varnish): http://localhost
  • Through the HTTP server directly (Nginx) to facilitate debugging: http://localhost:8080

You can also help us improve the documentation of this page.

Made with love by

Les-Tilleuls.coop can help you design and develop your APIs and web projects, and train your teams in API Platform, Symfony, Next.js, Kubernetes and a wide range of other technologies.

Learn more

Copyright © 2023 Kévin Dunglas

Sponsored by Les-Tilleuls.coop