(Docker image ready to use)
This docker image is tested for symfony 3 and 4 projects along with other database supporting docker images such as mysql:5.7, phpmyadmin/phpmyadmin
Image tags reference : theva/docker-symfony
-
Create your
docker-compose.yml
as simple as you see indocker-symfony/docker-compose/simple/docker-compose.yml
-
Execute docker-compose.yml in the terminal
docker-compose up -d --build
-
if there is no build error and if the containers are created, then you can access your site at http://app.local
if you are need of your docker container (local server) be supported for ssl, follow these steps
-
Add these files somewhere in to your project directory
- docker-symfony/certs/cert.key
- docker-symfony/certs/cert.pem
- docker-symfony/conf/app.conf
-
Change these lines in the file conf/app.conf according to your project
- ServerName app.local ##line-2
- DocumentRoot /var/www/public ##line-3
- <Directory "/var/www/public"> ##line-10
- DocumentRoot /var/www/public ##line-24
-
Create a Dockerfile and use theva/docker-symfony as base image Add some additional commands
FROM theva/docker-symfony WORKDIR /var/www RUN mkdir -p /etc/apache2/external COPY $FILE_PATH/certs/* /etc/apache2/external/ COPY $FILE_PATH/conf/* /etc/apache2/sites-enabled/ RUN rm /etc/apache2/sites-enabled/000-default.conf RUN a2enmod ssl #enable ssl EXPOSE 80 EXPOSE 443
-
Create your
docker-compose.yml
as you see indocker-symfony/docker-compose/ssl/docker-compose.yml
-
Execute docker-compose.yml in the terminal
docker-compose up -d --build
-
if there is no build error and if the containers are created, then you can access your site at https://app.local or http://app.local