i’m very new to docker.
So i have this docker-compose.yaml
version: '3.8'
services:
php-apache-environment:
container_name: php-apache
#image: php:8.0-apache
build:
#context: ./php
dockerfile: Dockerfile
depends_on:
- db
volumes:
- ./php/src:/var/www/html/ --> i think the problem is here
ports:
- 8000:80
db:
container_name: db
image: mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: root
ports:
- "9906:3306"
phpmyadmin:
image: phpmyadmin
restart: always
ports:
- 8080:80
And this dockerFile
FROM php:8.0-apache
RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli
RUN php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer
RUN apt-get update && apt-get -y --no-install-recommends install git
&& php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer
&& rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-install pdo pdo_mysql
# Install required dependency
RUN apt-get update && apt-get install -y
zip
libxml2-dev
libzip-dev
# Configure and install gd extension
RUN apt-get update && apt-get install -y
libfreetype6-dev
libjpeg62-turbo-dev
libpng-dev
&& docker-php-ext-configure gd --with-freetype --with-jpeg
&& docker-php-ext-install -j$(nproc) gd
# Install Postgre PDO
RUN apt-get install -y libpq-dev
&& docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql
&& docker-php-ext-install pdo pdo_pgsql pgsql
# Install zip and zml
RUN docker-php-ext-install zip xml
# Enable mod_rewrite for images with apache
RUN if command -v a2enmod >/dev/null 2>&1; then
a2enmod rewrite headers
;fi
#Memcached Installation
RUN apt-get update && apt-get install -y libz-dev libmemcached-dev && rm -r /var/lib/apt/lists/*
RUN pecl install memcached
RUN echo extension=memcached.so >> /usr/local/etc/php/conf.d/memcached.ini
It works but my php project is very slow.
I use docker desktop on windows 11 and, after some reading i think the problem is in this line of code
volumes:
- ./php/src:/var/www/html/ --> i think the problem is here
Because this create my project into a windows folder (eg: project/php/src/[folder with project files])
How i can solve? How i can move my project into WSL folder?