Run the Symfony framework in a Docker container (all necessary modules are included). Good to go!
2.5K
A highly optimized, production-ready, cloud-native Docker image for the Symfony Framework running on a lightweight Alpine Linux base. This image bundles an optimized web server (Nginx), a high-performance process manager (PHP-FPM), process tracking (Supervisor), and comprehensive multimedia processing utilities (FFmpeg, youtube-dl).
It features an intelligent initialization runtime that configures performance metrics, hooks up multi-driver database extensions, scans for dynamic SSL files, and automatically bootstraps a blank Symfony framework template upon container boot if no code is present.
user www-data;. Virtual host routing files reside inside /etc/nginx/http.d/ for easy customization.pm.max_children = 50) optimized to mitigate memory leaks by recycling processes safely via max_requests./var/www/html/public.pdo_mysql, pdo_pgsql, and mysqli extensions out of the box to eradicate connection errors.128M) paired cleanly alongside expanded execution buffers (300s) to ensure long video processing jobs handle smoothly..pem or .crt file combinations directly into unified server symlinks.exec "$@" process forwarding hooks to place the Supervisor engine as Process ID 1 for clean shutdown signaling in production clusters.| Architecture | Available | Tag |
|---|---|---|
| x86-64 | ✅ | amd64-<version-tag> |
| arm64 | ✅ | arm64v8-<version-tag> |
If you want run only the docker-symfony core image, here is the docker-compose file.
name: docker-symfony
services:
# 🌐 1. Custom Symfony Framework & Web Engine Container
symfony-8008:
image: kprimecity/docker-symfony:latest
container_name: symfony-8008
restart: always
ports:
- "8008:80" # Access site locally via http://localhost:8008
- "8443:443" # Access site securely via https://localhost:8443
volumes:
- /path/to/project/nginx/ssl:/etc/ssl/nginx # Mount custom SSL certificate pair folders
- /path/to/project/nginx:/etc/nginx/http.d # Mount Virtual Host configuration blocks
- /path/to/project/html:/var/www/html # Mount the Symfony framework source files
networks:
- docker-symfony-network
networks:
docker-symfony-network:
name: docker-symfony-network
driver: bridge
default:
name: docker-symfony_default
This is the orchestration profile showing how to hook up your Symfony container seamlessly alongside isolated PostgreSQL, Redis, and pgAdmin data layers.
name: docker-symfony
services:
# 🌐 1. Custom Symfony Framework & Web Engine Container
symfony-8008:
image: kprimecity/docker-symfony:latest
container_name: symfony-8008
restart: always
ports:
- "8008:80" # Access site locally via http://localhost:8008
- "8443:443" # Access site securely via https://localhost:8443
volumes:
- /path/to/project/nginx/ssl:/etc/ssl/nginx # Mount custom SSL certificate pair folders
- /path/to/project/nginx:/etc/nginx/http.d # Mount Virtual Host configuration blocks
- /path/to/project/html:/var/www/html # Mount the Symfony framework source files
environment:
DATABASE_URL: "postgresql://symfony_user:secure_password@postgres-db:5432/symfony_db?serverVersion=16&charset=utf8"
REDIS_URL: "redis://:redis_secure_pass@redis-cache:6339"
depends_on:
postgres-db:
condition: service_healthy
redis-cache:
condition: service_healthy
networks:
- docker-symfony-network
# 🐘 2. Standalone PostgreSQL Engine Container
postgres-db:
image: postgres:16-alpine
container_name: postgres_db_engine
restart: always
environment:
POSTGRES_DB: symfony_db
POSTGRES_USER: symfony_user
POSTGRES_PASSWORD: secure_password
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U symfony_user -d symfony_db"]
interval: 5s
timeout: 5s
retries: 5
networks:
- docker-symfony-network
# 🔴 3. Standalone Redis Cache Storage Container
redis-cache:
image: redis:7-alpine
container_name: redis_cache_engine
restart: always
command: redis-server --port 6339 --requirepass redis_secure_pass
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "-p", "6339", "ping"]
interval: 5s
timeout: 3s
retries: 5
networks:
- docker-symfony-network
# 🗄️ 4. Standalone pgAdmin Management UI Container
pgadmin-ui:
image: dpage/pgadmin4
container_name: pgadmin_management_web
restart: always
environment:
PGADMIN_DEFAULT_EMAIL: [email protected]
PGADMIN_DEFAULT_PASSWORD: admin_secure_pass
ports:
- "5050:80" # Access database administration center via http://localhost:5050
depends_on:
- postgres-db
networks:
- docker-symfony-network
volumes:
postgres_data:
redis_data:
networks:
docker-symfony-network:
name: docker-symfony-network
driver: bridge
default:
name: docker-symfony_default
Every time your container boots up, the interior entrypoint script (start.sh) processes the following sequential logic parameters:
custom-php.ini, custom-opcache.ini, custom-www-php-fpm.conf) and injects them safely across their spec directories./var/www/html/public/index.php. If it exists, it skips installation and clears application cache files. If it is missing, it executes automated non-interactive Composer scripts (--no-interaction --prefer-dist) to download the symfony/skeleton application layer core, pulls the webapp profile, and downloads the youtube-dl-php framework dependencies automatically./etc/ssl/nginx. If any valid private key and certificate pair match are found, it generates local tracking symbolic links (server.crt and server.key) dynamically.www-data and transparently swaps process tracking control over to Supervisor to enforce PID 1 compliance.custom-opcache.ini establishes opcache.validate_timestamps=0. This locks compiled code into memory permanently for extreme speed. Remember that new code updates require a total container restart or pod rollout to flush the memory pool.cert-manager for Automated Let's Encrypt handling) decrypt and terminate SSL traffic natively at the cluster boundary, passing standard HTTP traffic on Port 80 down to your pods.After running the container, access your application in your browser:
https://localhost:8443
You should see your index page rendered by the docker-symfony's nginx server.
[!NOTE] No need to start
Any web serverto access your project.
This project is licensed under the terms of the GPL-3.0 License. Created and maintained by kprimecity.
Take care! 💖
Content type
Image
Digest
sha256:cfe9f20c0…
Size
193 MB
Last updated
23 days ago
docker pull kprimecity/docker-symfony