Nginx issue, when i am stop and starting the app getting "502 Bad Gateway"

You wouldn’t get a 502 if the container wasn’t running. If you had waited a bit more the site would have started working.

It’s not that stopping and starting did anything, it’s just that you waited long when you did the restart.

It is expected that you will have a 502 error for a period of time while the container starts up. You don’t have a problem.