@wilmer.lemke
To install a Symfony project with Docker, follow these steps:
- Create a new Symfony project using Composer:
Run the following command to create a new Symfony project with Composer:
composer create-project symfony/skeleton my_project_name
Replace my_project_name with the name of your Symfony project.
- Create a Dockerfile:
Create a file named Dockerfile in the root directory of your Symfony project and add the following content:
FROM php:8.0-apache
RUN apt-get update && apt-get install -y zip unzip && docker-php-ext-install pdo_mysql
WORKDIR /var/www/html
COPY . /var/www/html
CMD ["apache2-foreground"]
- Create a docker-compose.yml file:
Create a file named docker-compose.yml in the root directory of your Symfony project and add the following content:
version: '3'
services:
web:
build: .
ports:
- "8000:80"
volumes:
- .:/var/www/html
- Build the Docker image:
Run the following command to build the Docker image for your Symfony project:
docker-compose build
- Start the Docker container:
Run the following command to start the Docker container for your Symfony project:
docker-compose up -d
- Access your Symfony project:
You can now access your Symfony project in a web browser by navigating to http://localhost:8000.
Your Symfony project is now successfully installed and running with Docker.