can't access apache on docker from my localhost can't access apache on docker from my localhost docker docker

can't access apache on docker from my localhost


On Windows/OS X, Docker is running inside a Linux virtual machine (Docker Toolbox) with a default IP address of 192.168.99.100. Thus, when you use docker run -p 80:80 to bind the container port to host port, it in fact binds to the virtual machine's port 80. Thus the address you need is http://192.168.99.100.

The 172.17.0.3 address is the address of the docker container inside that virtual machine, and is not accessible directly from Windows/OS X.


Add a line to your DockerFile before restarting apache.

RUN echo 'ServerName localhost' >> /etc/apache2/apache2.conf