I create a php-composer image using dockerfile:
FROM php:7
RUN apt-get update
RUN apt-get install curl
RUN curl -sS https://getcomposer.org/installer -o composer-setup.php
RUN php composer-setup.php --install-dir=/usr/local/bin --filename=composer
RUN apt-get install -y git
And I run following commands to create a container and start a laravel app.
docker run -p 127.0.0.1:3000:8000 --name MyTest -dt php-composer to create a container
docker cp laravelApp/ d4bbb5d36312:/usr/
docker exec -it MyTest bash
cd usr/laravelApp
php artisan serve
After thet, container's terminal will show the success info:
Laravel development server started: <http://127.0.0.1:8000>
But when I access 127.0.0.1:3000 at local browser, I get nothing.
So is it possible that simply run php artisan serve to start a laravel app inside docker container?
Or I must to using nginx or apache to run it?
php artisan serve
server isn't for use in production, and your development environment should be as close to production as possible.