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

haydenp's avatar

Docker: Mounted Laravel project shows “Index of” list of files/folders in the root

Hi

I'm new to Docker and would love a little assistance on this ...

I have a Dockerfile (see below). If I copy it into a Laravel project and build an image, then run it in a container - all works correctly. As I will be actively working on the Laravel project, this is not ideal. So instead I try mount the Laravel project into an image made from Dockerfile alone, it doesn't work. The steps i take are ...

I copied the same Docerfile below into an empty folder then created a docker image from it.

cd sites/docker-laravel
docker build -t docker-laravel ."

The image is built without error. I then mount a local, clean Laravel project into it.

docker run -tid -p 80:80 -v ~/Sites/docker-laravel:/var/www/html docker-laravel

If I then browse to http://192.168.99.100/ it displayed the “Index of” list of files/folders in the root of the Laravel project that was mounted.

Can anyone point me in the right direction?

How would one get composer running? I had to comment out “RUN composer install” as the image would not build correctly.

Many thanks

# Dockerfile
FROM tutum/apache-php
ENV ALLOW_OVERRIDE true
RUN apt-get update && apt-get install -yq git php5-mcrypt && rm -rf /var/lib/apt/lists/*
RUN php5enmod mcrypt
RUN rm -fr /app
ADD . /app
RUN rm /var/www/html
RUN ln -s /app/public /var/www/html
# I’ve commented this out else composer install causes errors during the build
#RUN composer install"
EXPOSE 80
0 likes
1 reply

Please or to participate in this conversation.