Overview
Building docker-php-mssql images locally is straightforward and allows you to test changes before contributing or customize images for your specific needs.Prerequisites
Before building images locally, ensure you have:- Docker installed and running on your machine
- Git installed for cloning the repository
- Sufficient disk space (Docker images can be several hundred MB)
Building Images
Choose your target image
The repository is organized by PHP version and type. Available combinations include:
- PHP Versions: 8.1, 8.2, 8.3, 8.4
- Types:
cli,fpm,cli-alpine,fpm-alpine,cli-alpine-swoole,fpm-alpine-swoole
8.2/cli- PHP 8.2 CLI on Debian8.3/cli-alpine- PHP 8.3 CLI on Alpine Linux8.4/fpm-alpine-swoole- PHP 8.4 FPM on Alpine with Swoole extension
Build the image
Use the following command pattern to build an image:Example: Building PHP 8.2 CLIExample: Building PHP 8.4 FPM AlpineExample: Building PHP 8.3 CLI Alpine with Swoole
Build Options
Custom Tags
You can use any tag name for local development:Build Arguments
The Dockerfiles may support build arguments for customization. Check the specific Dockerfile for available options:Multi-platform Builds
For building multi-platform images (e.g., for ARM architectures), use Docker Buildx:Multi-platform builds may take significantly longer as they build for multiple architectures.
Troubleshooting
Build Fails with Network Errors
If the build fails while downloading packages:- Check your internet connection
- Retry the build - temporary network issues are common
- Check if package repositories are accessible
Insufficient Disk Space
Docker images can be large. To free up space:Microsoft ODBC Driver Installation Fails
If the Microsoft ODBC Driver installation fails:- Check that the Microsoft repository is accessible
- Review the Dockerfile for the correct ODBC driver version
- Check Docker logs for specific error messages:
Build Cache Issues
If you suspect cached layers are causing issues, rebuild without cache:Next Steps
After building your images locally:- Test the images to verify functionality
- Contribute your changes back to the project
- Use the images in your local development environment
