使用docker compose从mac osx网桥网络上的docker容器访问ip

hiz5n14c  于 2021-05-27  发布在  Hadoop
关注(0)|答案(1)|浏览(712)

我正在尝试从hadoop集群的docker compose上的容器访问WebUI。链接:https://github.com/big-data-europe/docker-hadoop
docker compose文件包含以下内容:

version: "3"

services:
  namenode:
    image: bde2020/hadoop-namenode:2.0.0-hadoop3.1.3-java8
    container_name: namenode
    ports:
      - 9870:9870
    volumes:
      - hadoop_namenode:/hadoop/dfs/name
    environment:
      - CLUSTER_NAME=test
    env_file:
      - ./hadoop.env

  datanode:
    image: bde2020/hadoop-datanode:2.0.0-hadoop3.1.3-java8
    container_name: datanode
    volumes:
      - hadoop_datanode:/hadoop/dfs/data
    environment:
      SERVICE_PRECONDITION: "namenode:9870"
    env_file:
      - ./hadoop.env

  resourcemanager:
    image: bde2020/hadoop-resourcemanager:2.0.0-hadoop3.1.3-java8
    container_name: resourcemanager
    environment:
      SERVICE_PRECONDITION: "namenode:9870 datanode:9864"
    env_file:
      - ./hadoop.env

  nodemanager1:
    image: bde2020/hadoop-nodemanager:2.0.0-hadoop3.1.3-java8
    container_name: nodemanager
    environment:
      SERVICE_PRECONDITION: "namenode:9870 datanode:9864 resourcemanager:8088"
    env_file:
      - ./hadoop.env

  historyserver:
    image: bde2020/hadoop-historyserver:2.0.0-hadoop3.1.3-java8
    container_name: historyserver
    environment:
      SERVICE_PRECONDITION: "namenode:9870 datanode:9864 resourcemanager:8088"
    volumes:
      - hadoop_historyserver:/hadoop/yarn/timeline
    env_file:
      - ./hadoop.env

volumes:
  hadoop_namenode:
  hadoop_datanode:
  hadoop_historyserver:

如果我运行命令“docker compose up”,我可以看到docker ps的容器和打开的端口。通过网络检查,我可以看到IP,但我无法访问它们。
我找到了关于macosx上主机网络不工作的信息。但这个网络是一个桥梁网络。
如何从容器访问WebUI?

z6psavjg

z6psavjg1#

要访问namenodeui,可以使用localhost:9870 since 这就是你转发的端口。您不需要“从其他容器”访问UI
这是唯一一个你打开的集装箱

相关问题