Skip to content

How to run multiple services in one Docker container. Running Nginx and Php-fpm services in the same container with Laravel using Docker (Mysql, Mariadb, Sqlite).

Notifications You must be signed in to change notification settings

atomjoy/laravel-nginx-php-mysql-multiple

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nginx and Php-fpm with Laravel on Docker

How to run multiple services in one Docker container. Running Nginx and Php-fpm services in the same Debian container with Laravel using Docker (Mysql, Mariadb, Sqlite).

Laravel project directory

# Remove webapp dir and create new Laravel app composer create-project laravel/laravel webapp # Or copy your Laravel project files to webapp

Config Mysql in files

.env webapp/.env

Build

# Build up docker compose up --build -d docker compose build --no-cache && docker compose up --force-recreate -d # Show docker compose ps # Interactive container terminal docker exec -it app_host bash docker exec -it mysql_host bash # Services in container service --status-all ps -aux

Run Php-fpm and nginx in same docker container

How to run multiple services in one docker container.

# Allow services autostart# RUN echo "exit 0" > /usr/sbin/policy-rc.d# Run php-fpm and nginx services (required don't remove) CMD /etc/init.d/php8.2-fpm start && nginx -g "daemon off;"
close