'Dockerfile Volume Laravel Project
I have an Laravel Cloud project where I need to store data in a Docker Volume.
So I created an own dockerfile with the following content. Problem is the volume itself is empty after the container run and also the target directory inside the container is empty.
Run Command:
docker run -p 80:80 -v /mylocaldir:/app/storage/app 477d61667e16
Dockerfile:
FROM webdevops/php-apache:7.3
WORKDIR /app
USER root
RUN apt-get update && apt-get -y install cron
COPY filemanager-cron /etc/cron.d/filemanager-cron
RUN chmod 0644 /etc/cron.d/filemanager-cron
RUN crontab /etc/cron.d/filemanager-cron
RUN touch /var/log/cron.log
# User Management
RUN groupadd -g 1001 appuser
RUN useradd -r -u 1001 -g appuser appuser
USER appuser
ADD --chown=appuser:appuser . .
ENV COMPOSER_VERSION=2
ENV PHP_POST_MAX_SIZE=2000M
ENV PHP_UPLOAD_MAX_FILESIZE=2000M
RUN composer2 install -d /app
RUN chmod -R 777 /app/storage
RUN chmod -R 777 /app/bootstrap
RUN chmod 777 /app/.env
EXPOSE 80
VOLUME [ "/app/storage/app" ]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
