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
EXPOSE 80
docker build --no-cache --tag $NAME .
docker run \
--hostname $NAME \
--publish "8080:80" \
--name $NAME \
$NAME
Written by Joel Dare on March 25th 2023.
Get a monthly digest of what I'm up to.