How to run PHP in Docker Container

If you ended up here you probably want a fast solution to get your PHP scripts running without installing Apache in your host PC.

Well, there you go (docker-compose.yml):

version: '3.8'
services:
    php-apache:
        container_name: php-apache
        image: php:8.0-apache
        volumes:
            - ./source/code:/var/www/html/
        ports:
            - 8000:80

Run docker-compose up and voila 😀

Leave a Reply