Let's say you made a docker image of Hadoop, which is called hd_image, and if you want to access Hadoop's 50070 and 8088 ports in a browser on an external network, when you start mirroring hd_image,
The script is as follows:
50070 8088 --name bbbbb hd_image
--name bbbbb, indicating that the name of this container is bbbbb.
-H AAAAA, which indicates that the host name in the container is AAAAA.
-D, which represents the detach mode.
-P 50070-p 8088, which means to bind the ports 50070 and 8088 of this container to your host.
At this point, you can access the application in your container by using the IP of your host's eth0 plus the port number of the map in the external network.
An example:
Ps
You'll find that the port mappings for the container and the host appear below ports, like mine:
0.0. 0.0:49212-500700.0. 0.0:49213-8088/tcp
Then execute the command:
sudo ifconfig eth0
will see your host's IP address, like mine.
Eth0 Link encap:ethernet HWaddr ,:xx: -: 0b:1b: +inet Addr:192.168.4. 341Bcast:192.168.4. 255Mask:255.255.255.0Inet6 addr:fe80::a00:27ff:fe0b:1b32/ -scope:link up broadcast RUNNING multicast MTU: theMetric:1RX Packets:5229Errors0Dropped0Overruns:0Frame0TX Packets:2850Errors0Dropped0Overruns:0Carrier0Collisions:0Txqueuelen: +RX Bytes:685234(669.1KiB) TX Bytes:2826660(2.6MiB)
At this point, you are in your browser, type:
192.168. 4.341:49212192.168. 4.341:49213
You can access the 50070-port and 8088-port applications of Hadoop in your Docker container separately, that's all!
Browser (extranet) access to Hadoop in Docker container