php-composer
Docker images for various PHP versions with Composer installed.
925
This repository provides Docker images for various PHP versions with Composer installed. It is designed to be a slim and secure base for PHP projects.
Available PHP versions:
mcrypt)To build the images, use the following commands from the root of the repository.
Note: For PHP 8.2 and above, we use Docker Hardened Images (DHI) as a base. You must be authenticated to dhi.io to pull the base images:
docker login dhi.io
Use your Docker Hub credentials and a Personal Access Token (PAT).
docker buildx build --platform linux/amd64,linux/arm64 -t davidzapata/php-composer:8.5 -t davidzapata/php-composer:latest --push 8.5/
docker buildx build --platform linux/amd64,linux/arm64 -t davidzapata/php-composer:8.4 --push 8.4/
docker buildx build --platform linux/amd64,linux/arm64 -t davidzapata/php-composer:8.2 --push 8.2/
docker buildx build --platform linux/amd64,linux/arm64 -t davidzapata/php-composer:5.6 --push 5.6/
You can pull the pre-built images:
docker pull davidzapata/php-composer:8.5
docker pull davidzapata/php-composer:8.4
docker pull davidzapata/php-composer:8.2
docker pull davidzapata/php-composer:5.6
docker pull davidzapata/php-composer:latest
Go into any project that has a composer.json and run the following commands.
# Using 8.5
docker run --rm -v $(pwd):/var/www davidzapata/php-composer:8.5 composer install
# Using 5.6
docker run --rm -v $(pwd):/var/www davidzapata/php-composer:5.6 composer install
docker run --rm -v $(pwd):/var/www davidzapata/php-composer:8.5 composer create-project --prefer-dist laravel/laravel blog
docker run --rm -p 80:80 -v $(pwd):/var/www davidzapata/php-composer:8.5 php -S 0.0.0.0:80 -t public
All images are tested for CVEs using Docker Scout.
To scan an image:
docker scout cves davidzapata/php-composer:8.5
The Dockerfiles follow best practices to remain slim and secure:
FROM davidzapata/php-composer:8.5
# your custom logic here
Content type
Image
Digest
sha256:db98a48b6…
Size
185.5 MB
Last updated
about 2 months ago
docker pull davidzapata/php-composer:8.4