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.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire