Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

nimo's avatar
Level 1

Docker/Laravel and session issues

Hi there, I've an issue with my setup, the storage folder consistently returns permission issues. chmod -R 777 storage fixed the problem but the issue returns after about 20min or so. More so, when I authenticate a user, the Auth::user() value is always empty, I get results after multiple page refresh and before then, the storage folder will scream permission and I have to chmod again.

Am I doing something wrong? Is there a better way to do this.

# Use this as a base image
FROM ubuntu:14.04

ENV LARAVEL_VERSION ~5.2.0

# Run any command on terminal
RUN apt-get update && \
    apt-get -y install apache2 php5 libapache2-mod-php5 php5-mcrypt php5-json curl git php5-mysql && \
    apt-get clean && \
    update-rc.d apache2 defaults && \
    php5enmod mcrypt && \
    rm -rf /var/www/html && \
    curl -sS https://getcomposer.org/installer | php && \
    mv composer.phar /usr/local/bin/composer

COPY docker/default.conf /etc/apache2/sites-available/000-default.conf

# Install Laravel
WORKDIR /var/www

# Expose necessary ports to the container
EXPOSE 80

CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]

My docker config.

0 likes
1 reply
vitr's avatar

What is your OS? docker version? How do you install Laravel and run this image?

Please or to participate in this conversation.