This is my Dockerfile contents:-
FROM php:7.0-apache
COPY src/ /var/www/html/public
VOLUME src/ /var/www/html/public
EXPOSE 800
Then I run this command.
docker run -p 80:800 final
So I tried to access the localhost, but it returns 'ERR_EMPTY_RESPONSE'.
Earlier it was giving 403 error.
OS - Mac
[Edit] Adding more detail


The php:7.0-apache image listens by default on port 80. The EXPOSE you are using in the Dockerfile does not change that.
Normally, you have no reason to try an change the default listening port of the container, hence it has it's own IP address and you should never run into a port conflict problem.
The port election might be an issue on the host and in this regard you may chose to publish on any port that is not in use.
If you simply swap 80 and 800 in your docker run command, you shall be able to access the web-app at localhost:800
The following command will create a DNAT rule from your host machine port <src> to the container port 80, making it possible to visit the web-app at localhost:<src>
docker run -p <src>:80 final
Edit answering forbidden problem update:
The php:7.0-apache image will look for an index.* under /var/www/html/. Your Dockerfile is copying the source into /var/www/html/public.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With