I want to run my simple PHP script. like return phpinfo() with frankenphp inside docker.
But I have a problem for this simple script. Always not resolve when accessing localhost:8080.
This my Dockerfile
FROM dunglas/frankenphp:latest
RUN apt-get update && apt-get install -y
git
unzip
vim
&& rm -rf /var/lib/apt/lists/*
WORKDIR /var/www/public_html
COPY ./app .
EXPOSE 80
CMD ["frankenphp", "php-server", "-r", "/var/www/public_html"]
and this my docker-compose
version: '3.8'
services:
app:
container_name: therapy_app
build:
context: .
dockerfile: Dockerfile
ports:
- "8080:80"
volumes:
- ./app:/var/www/public_html
environment:
- APP_ENV=local
- APP_DEBUG=true
networks:
- therapy_nt
networks:
therapy_nt:
driver: bridge
This my index.php file
<?php
phpinfo();
after I run docker compose up -d
succeeded running the container.
But, when I access localhost:8080
it doesn’t work.
Folder structure :
- app
+ index.php
- Dockerfile
- docker-compose.yml
Is there something missing from my steps?