0👍
✅
The EXPOSE
statement doesn’t really do anything. It’s mostly a bit of documentation on what port your container listens on. And in your case it’s not correct, since Nginx listens on port 80 by default.
When you run the container, you should map port 80 to the port you want to use on the host. I.e.
docker run -it -p 8080:80 --rm dependency_check_front
Now you should be able to reach your app at http://localhost:8080/
You should remove the EXPOSE statement in your Dockerfile, since it can confuse anyone looking at your Dockerfile later.
If you really want Nginx to listen on port 8080, you have to configure Nginx to do that, but IMO it’s not worth it. Just have it listen on port 80.
Source:stackexchange.com