Server Error (500) when starting my dockerized laravel app

I have created a laravel app and then created a Dockerfile:

FROM php:7.4-cli

RUN apt-get update -y && apt-get install -y libmcrypt-dev

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN docker-php-ext-install pdo
#mbstring

WORKDIR /app
COPY . /app

RUN composer install

EXPOSE 8000
CMD php artisan serve --host=0.0.0.0 --port=8000

Then I ran sudo docker build -t myApp . and sudo docker run -it -p 8000:8000 news-organizer. Everything worked fine.

When I copy this folder (with Dockerfile) to another location and run composer update --ignore-platform-reqs, sudo docker build --no-cache -t theApp . and sudo docker run -it -p 8888:8888 theApp the Web App starts. When I enter 127.0.0.1:8888 I get the 500 Error.

I already set all rights to sudo chmod 755 -R <myLaravelFolder>. I also tried setting different port numbers. The Dockerfile of the new folder is:

FROM php:7.4-cli

RUN apt-get update -y && apt-get install -y libmcrypt-dev

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN docker-php-ext-install pdo
#mbstring

WORKDIR /app
COPY . /app

RUN composer install

EXPOSE 8888
CMD php artisan serve --host=0.0.0.0 --port=8888

I just can’t find a way to fix the 500 Error. What can I do?

My basic idea is: Creating a Laravel Web-App. Then creating a Dockerfile and upload it somewhere. Then others can download the Web App, install Docker, and run sudo docker build -t <myImage> . and sudo docker run -it -p 8000:8000 <myImage>. With that they can use my Laravel App on their computers as docker container.

I run xubuntu 20.04 as OS.

from Newest questions tagged laravel-5 – Stack Overflow https://ift.tt/2TqIirw
via IFTTT

Related Posts

Codeigniter : Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE) in Laravel project

I’m getting following error: **Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE)** Note : It’s working in local but facing issue in production server. private…

Firebase receive notification while tab is active or on focus

What i want is to be able to perform an action when a user receives a notification while the browser is open and tab is active or…

Laravel’s alias loader does not find class

We have a legacy project that we cannot update and we need to make some changes in symfony’s Response.php in vendor. We have solved this by copying…

Laravel 5 – generic document management

I have a system where you can create different types of unique documents. For instance, one document is called Project Identified and this expects certain inputs. Originally,…

Laravel Nova limit the results in indexQuery

I ran intro a situation where I need to limit the results of a resource to only 3 results. To be more specific, based on the logged…

Auditoria en laravel 5.8 [closed]

Cómo puedo automatizar el registro de actividades de un usuario en laravel? Si un usuario ingresa a un app de laravel, debo guardar toda su actividas, a…

Leave a Reply

Your email address will not be published.