Docker Community Forums

Share and learn in the Docker community.

Files created in container not sync with local

Hi
I don’t know if it is the correct way, but i use this dockerfile

FROM php:7.2-apache

COPY infra/apache-default.conf /etc/apache2/sites-available/000-default.conf

RUN apt-get update && apt-get -y install
zlib1g-dev
unzip
libpq-dev
libmcrypt-dev
libfcgi0ldbl
libfreetype6-dev
libjpeg62-turbo-dev
libpng-dev

#INSTALL APCU
ARG APCU_VERSION=5.1.17
RUN yes ‘yes’ | pecl install -f apcu-${APCU_VERSION} && docker-php-ext-enable apcu
#APCU

RUN docker-php-ext-install
pdo_mysql
mbstring
zip
exif
pcntl

RUN docker-php-ext-configure gd --with-gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/
RUN docker-php-ext-install gd
RUN a2enmod rewrite

#CONF PHP
RUN echo “memory_limit = -1” > /usr/local/etc/php/conf.d/memory_limit.ini
#PHP

COPY . /var/www/html/
WORKDIR /var/www/html/

#COMPOSER
RUN curl -sS https://getcomposer.org/installer | php
#COPY composer.* ./
RUN php composer.phar global require hirak/prestissimo
RUN php composer.phar clearcache
RUN php composer.phar install
#COPY . ./
RUN php composer.phar dump-autoload
#COMPOSER

RUN chown -R www-data.www-data .
RUN find . -type d -exec chmod 775 {} ;
RUN find . -type f -exec chmod 664 {} ;

RUN php artisan config:clear
RUN php artisan cache:clear

RUN rm -f public/storage
RUN ln -sr storage/app/public public/storage

EXPOSE 80

and this docker-compose

version: ‘3.5’

services:

idralia-shop:
build:
context: .
dockerfile: Dockerfile
image: {APP_NAME} hostname: {APP_NAME}
domainname: {APP_NAME} volumes: - ./:/var/www/html container_name: {APP_NAME}
ports:
- 9008:80
environment:
DB_HOST: docker.for.mac.localhost
VIRTUAL_HOST: ${APP_NAME}
APP_URL: http://idralia.shop:9008

I use that only for local development.
When ‘composer install’ is executed in dockerfile, i’ll expect that vendor folder will be created in container and then i will see it in my project root on my host, but it miss.

am i thinking wrong or there is a configuration error?

Regards
Daniele