How do I add a PHP extention to an image? I am trying to build a LAMP docker with the PHP extension inotify tools
My file looks like the following - what is next to get inotify working?:
`
version: '24.0.5'
services:
www:
image: php:8.2.10-apache-bullseye
volumes:
- "./:/var/www/html"
ports:
- 80:80
`
I have Docker-Desktop with a Linux based LAMP image
I tried this dockerfile but exits 0
FROM php:8.0-apache
WORKDIR /var/www/html
COPY index.php index.php
RUN pecl install inotify
EXPOSE 80
Oh my goodness! - Then I thought of ChatGPT
The solution
To create a Docker container for a LAMP (Linux, Apache, MySQL, PHP) server with the PHP extension inotify, you can follow these steps:
Replace
./your-php-fileswith the actual path to your PHP application files.This command will build the Docker image with the tag "lamp-with-inotify."
This command will start a container named "lamp-container" and map port 8080 on your host to port 80 in the container.
http://localhost:8080orhttp://<your-docker-host-ip>:8080.Now you have a Docker container running a LAMP server with the PHP inotify extension. Make sure to adapt the PHP version and other configurations as needed for your specific application.
inotify