Giter Site home page Giter Site logo

malke / docker-php Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dyarleniber/docker-php

0.0 0.0 0.0 6.42 MB

PHP 8 development environment with PHP-FPM, Nginx and MySQL, using Docker and Docker Compose.

License: MIT License

Dockerfile 36.02% PHP 51.68% Shell 12.30%

docker-php's Introduction

PHP 8 development environment with PHP-FPM, Nginx and MySQL, using Docker and Docker Compose

You need to have Docker and Docker Compose installed on your server to proceed using this PHP environment.

The following three separate service containers will be used:

  • An app service running PHP 8 FPM.
  • A db service running MySQL.
  • An nginx service that uses the app service to parse PHP code before serving the application to the final user.

Running the environment

  • Set the MySQL environment variables creating a .env file based on the .env.example file.

  • Build the app image with the following command:

docker-compose build app
  • When the build is finished, you can run the environment in background mode with:
docker-compose up -d
  • To show information about the state of your active services, run:
docker-compose ps

You can use the docker-compose exec command to execute commands in the service containers, such as an ls -l to show detailed information about files in the application directory:

docker-compose exec app ls -l
  • Now go to your browser and access your server’s domain name or IP address on port 8000: http://server_domain_or_IP:8000. In case you are running this demo on your local machine, use http://localhost:8000 to access the application from your browser.

  • You can use the logs command to check the logs generated by your services:

docker-compose logs nginx
  • If you want to pause your Docker Compose environment while keeping the state of all its services, run:
docker-compose pause
  • You can then resume your services with:
docker-compose unpause
  • To shut down your Docker Compose environment and remove all of its containers, networks, and volumes, run:
docker-compose down

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.