Solving the Problem that Docker Desktop for Mac can’t route traffic to containers and You can access the containers by IP right away away in Docker for Mac Platform!
- Install a Docker for Mac
- Run a Hadoop image in Docker
- View Hadoop HDFS WebUI by Using Hadoop containers IP
docker inspect bbbbb | grep "IPAddress"
- Visit
http://172.17.0.2:50070/
Found out I can't access HDFS WebUI- Try to ping container ip from mac terminal, it's failed too!
- Then I checked the official docker documentation and found out the problem Docker Documentation
- If you want to connect a container from the Mac, you need to use
Port Mapping
like below
docker run -d –it -p 50070 -p 8088 --name bbbbb sequenceiq/hadoop-docker:2.7.1
- But I found some other problems, such as
can't open log file
,can't download Hadoop output result file.
from WebUI directly! You have to reach those file by using terminal command, Troublesome!
- Using Docker for Mac an experimental function:
Socket Proxy
brew install jq
cd ~/Library/Group\ Containers/group.com.docker/
mv settings.json settings.json.backup
cat settings.json.backup | jq '.["socksProxyPort"]=8888' > settings.json
sudo apachectl start
function FindProxyForURL(url, host) {
if (isInNet(host, '172.17.0.0', '255.255.0.0')) {
return 'SOCKS5 127.0.0.1:8888'
}
if (isInNet(host, '172.22.0.0', '255.255.0.0')) {
return 'SOCKS5 127.0.0.1:8888'
}
return 'DIRECT'
}
cat /etc/hosts
vim /etc/hosts
http://localhost:32769
http://localhost:32768
http://172.17.0.2:8088
http://172.17.0.2:50070
It won't occupy your Mac local Port
All WebUI support invoke each other, such as
ResourceManager Web UI: 8088
NodeManager Web UI: 8042
NameNode Web UI: 50070
DataNode Web UI: 50075
Secondary NameNode Web UI: 50090
JobTracker Web UI: 50030
TaskTracker Web UI: 50060
Looking at current status of HDFS, explore file system
Exploring file system, download HDFS file directly
Checking status and log file
[D1] https://docs.docker.com/docker-for-mac/networking/
[D2] https://windmt.com/2019/08/30/docker-for-mac-network/
[D3] https://www.jianshu.com/p/d006a34a343f