Joel Dare

Building a PHP App with Docker

The following is a quick start for running a simple PHP application via Docker. Replace $NAME with a name you want to use for your container.


# Use the alpine base image (small)
FROM php:apache

# Copy the files into place
COPY ./ /var/www/html/

# Ports we want in the container

Building the Image

docker build --no-cache --tag $NAME .

Running a Container

docker run \
    --hostname $NAME \
    --publish "8080:80" \
    --name $NAME \

Written by Joel Dare on March 25th 2023.