A simple php hellow world in Docker
318
This repository contains a simple "Hello World" application in PHP, designed to run on Apache through Docker.
The Dockerfile uses the official PHP 8.2 image with Apache. It copies index.php into the Apache root directory and exposes port 80.
# Use the official PHP image with Apache
FROM php:8.2-apache
# Copy the index.php file to the Apache server root
COPY index.php /var/www/html/
# Expose port 80
EXPOSE 80
# Start Apache in the foreground
CMD ["apache2-foreground"]
<?php
// Enable PHP error reporting
ini_set('display_errors', 1);
error_reporting(E_ALL);
// "Hello, World!" message
echo "¡Hola, Mundo!";
?>
Pull the Image from Docker Hub
docker pull cabohorquez/holamundo-php
Run the Docker Container
docker run -p 80:80 cabohorquez/holamundo-php
Access the Application
Open your browser and navigate to http://localhost. You should see the message ¡Hola, Mundo! displayed on the screen.
The following files are ignored in the build:
*.log*.mdContent type
Image
Digest
sha256:6186e63dc…
Size
169.1 MB
Last updated
almost 2 years ago
docker pull cabohorquez/holamundo-php