Accessing apache2 residing inside Docker container from Host machine web browser
Problem 1: Apache default port
2375
port is not the apache default port, it is the docker daemon default port, the command shall be
docker -t -i -p 49200:80 [image-id]
Problem 2: port in different machine
49200:80
This is the mapping from internal port 80
to docker host 49200
, the docker host is actually your virtual box VM (guess is your boot2docker shell)
In your virtual box VM console, you can
curl localhost:49200
The picture "Port Forwarding rules" are helping your port forward to your virtualbox host, for you it is MacOS, where you mapped 49200
to MacOS 49200
as well
So in your MacOS shell console, you can also
curl localhost:49200
If you know the virtualbox VM (docker host) IP address, for example it is 192.168.59.103
as default for boot2docker, then you can
curl 192.168.59.103:49200
If you want to access the apache docker container via 172.17.0.7
, remember this is the private network inside, you need to start another container like
docker -t -i busybox bash
# curl 172.17.0.7:80
Summary
docker -p
is port forwarding your internal port to docker host
"Port forwarding Rules" in virtualbox setting is port forwarding your VM port to VM host
- apache docker container: 172.17.0.7:80
- docker host=virtualbox VM: 192.168.59.103:49200
- virtualbox host=MacOS: xxxx:49200
Can't connect to ActiveMQ Console running in Docker container
Got it to work!
For those having the same issue, I resolved it by changing the IP address in jetty.xml
from 127.0.0.1
to 0.0.0.0
. I am now able to connect to my containerized AMQ instance from my host OS.
Related Topics
Pid File Exists, But Process Is Not Running
Linux: Triggering Shell Command on File Save
How to Couple Xargs with Pdftotext Converter to Search Inside Multiple PDF Files
Linux: How to Send a Whole Packet to a Specific Port on Another Host
How to Specify a Local Bond Interface to Multicast Socket in Haskell
Arguments Were Passed Wrong in Pthread
List of Synchronous and Asynchronous Linux/Posix Signals
Changing Matlab's Startup Folder in Linux
How to Avoid High CPU Usage While Reading/Writing Character Device
Skip Successfully Downloaded Files Using Wget
Number of Subdirectories in a Directory
How to Upgrade a Package in Linux That Was Built from Source
Can a Gnome Application Be Automated? How
Setting Path to Shared Library Inside a Makefile for Compile
What Does Signal(Sigchld, Sig_Dfl); Mean
Jenkins Cannot Run Firefox: No Protocol Specified Error: Cannot Open Display:: 0