Using Docker for Laravel + NuxtJS Single Application

I’m a newbie in Docker.
I’m developing a Laravel+NuxtJS Application.
My structure is this:
/api. → contains laravel (using Laravel Sail)
/admin. → NuxtJS SPA for admin panel
/web → NuxtJS SPA for user-facing website

In my local dev environment, I’m running 3 docker containers, 1 for api, admin and web. I was able to run one of the NuxtJS using port 3000. I’m using port 4000 for web but the page doesn’t open when I view it in the browser using http://localhost:4000/.

I’m not sure if I’m doing it the right way.
Here’s a screenshot of the docker containers:

Thanks in advance!


Things to check:

  1. when you write “localhost” the container must be running on the same host as your browser, else you need to write http://SERVERIP:4000

  2. I can see that the other one is running on port 3000, did you make sure that the web one is also listning on port 4000? the port mapping 4000:4000 means that you will access it on port 4000 (as you do in your example) but the 4000 on the right side of the colon, means that port 4000 is also listning in your NuxtJS application, and since the other one is port 3000, i would SUSPECT, that it should be 4000:3000.

  3. logs logs logs logs, check the logs for the container where it dosnt work :slight_smile:

1 Like

Hi! #2 worked for me.
Thank you so much!

1 Like