I am new to Docker and I trying to setup a Laravel project inside a Docker. I successfully built and ran the container. Everything worked fine.
However, after removing all containers and images and attempting to rebuild, the process now fails, even though it worked previously. Here is my logs:
ERROR [app internal] load build context
=> transferring context: 2.92GB
archive/tar: unknown file mode ?rwxr-xr-x
This is my Dockerfile:
FROM php:8.2-apache
RUN apt-get update && apt-get install -y \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
zip \
unzip \
git \
curl \
&& docker-php-ext-install pdo pdo_mysql gd
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
WORKDIR /var/www/html
COPY . .
RUN git config --global --add safe.directory '*'
RUN git config --system --add safe.directory /var/www/html
RUN git config --system --add safe.directory /var/www/html/vendor/theseer/tokenizer
RUN chown -R www-data:www-data /var/www/html
RUN chmod -R 775 /var/www/html
RUN rm -rf vendor
RUN composer install --no-dev --optimize-autoloader --no-interaction
RUN chmod -R 777 storage bootstrap/cache
EXPOSE 80
CMD ["apache2-foreground"]
What I've tried:
- Running docker system prune -a to remove all containers, images, and caches.
- Checking the .dockerignore file to ensure unnecessary files are excluded.
- Deleting
node_modules
andpackage-lock.json
, then runningnpm install
again. - Checking Docker and Composer versions 4.38.0
Questions:
- Why does the build fail now when it worked before?
- Is there something being lost when I delete the build that prevents it from rebuilding correctly?
I am not sure why this is happening, especially since the same setup worked before. Has anyone encountered this issue before? How can I fix it?
Any help would be appreciated!