Containerfiles with Alpine, Apache, and PHP
A Containerfile is a build recipe. It is preferable to manually modifying a running container because the result can be reviewed and rebuilt. Basic image commands are covered in Installing Podman and Understanding Containers.
A small Apache image
Create a directory with Containerfile and index.html:
FROM docker.io/library/httpd:2.4
COPY index.html /usr/local/apache2/htdocs/index.html
EXPOSE 80
FROM selects the base image, COPY adds application content, and EXPOSE documents the intended container port. EXPOSE does not publish a port by itself.
Build and run it:
podman build --tag localhost/site:0.1 .
podman run --name site --detach --publish 8080:80 localhost/site:0.1
curl http://127.0.0.1:8080
PHP considerations
For PHP, start from a PHP image that already includes Apache and explicitly verify required extensions:
podman run --rm docker.io/library/php:8.3-apache php -m
Do not copy a docker-php-ext-install command blindly. Extensions may already be installed, or the build may need compiler and development packages. Prefer a documented, pinned build recipe and a dependency scan.
Build hygiene
Use a .containerignore file to keep credentials, caches, and unrelated files out of the build context. Pin major/minor versions for tutorials, scan images where appropriate, and never bake passwords into an image layer.