I tried to access the execution results in the docker container from this machine. The following is my attempt:
A php-composer image was created 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
Create a container and execute laraverapp with the following command:
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
Next, on terminal, I will see information about the successful execution of laravel app:
Laravel development server started: <http://127.0.0.1:8000>
However, when I visited 127.0.0.1:3000 with my browser, I could not get the result of execution.
May I ask why?
Monitoring in Containerhttp://127.0.0.1: 8000 only accepts requests in containers and needs to be started in the following way:
php artisan serve --host=0.0.0.0