Skip to content
Advertisement

A little problem with starting Laravel server in docker container

JavaScript

I have deployed the Laravel 8.x source code in web_laravel docker. I did not get any error while running composer update and php artisan serve.

JavaScript

But, when I access 192.168.1.xx:8000 in browser, I get the following error.

JavaScript

I tried to ping 192.168.1.xx, it works fine. But, I got the following error when using telnet.

JavaScript

It seems that I am having a little problem with starting Laravel server in docker. Could anybody help me?

Advertisement

Answer

Solved:


As far as I know, each docker has an IP address. So, I have to start the server with the IP address of docker container. However, to avoid errors from docker’s dynamic IP address, I use 0.0.0.0 instead of the IP address of web_laravel docker because 0.0.0.0 means all IPv4 addresses on the local machine. I use the following command.

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement