不多说
https://github.com/big-data-europe/docker-hadoop
修改为如下
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 datanode1: image: bde2020/hadoop-datanode:2.0.0-hadoop3.1.3-java8 container_name: datanode1 volumes: - hadoop_datanode1:/hadoop/dfs/data environment: SERVICE_PRECONDITION: "namenode:9870" env_file: - ./hadoop.env depends_on: - namenode datanode2: image: bde2020/hadoop-datanode:2.0.0-hadoop3.1.3-java8 container_name: datanode2 volumes: - hadoop_datanode2:/hadoop/dfs/data environment: SERVICE_PRECONDITION: "namenode:9870" env_file: - ./hadoop.env depends_on: - namenode datanode3: image: bde2020/hadoop-datanode:2.0.0-hadoop3.1.3-java8 container_name: datanode3 volumes: - hadoop_datanode3:/hadoop/dfs/data environment: SERVICE_PRECONDITION: "namenode:9870" env_file: - ./hadoop.env depends_on: - namenode datanode4: image: bde2020/hadoop-datanode:2.0.0-hadoop3.1.3-java8 container_name: datanode4 volumes: - hadoop_datanode4:/hadoop/dfs/data environment: SERVICE_PRECONDITION: "namenode:9870" env_file: - ./hadoop.env depends_on: - namenode resourcemanager: image: bde2020/hadoop-resourcemanager:2.0.0-hadoop3.1.3-java8 container_name: resourcemanager environment: SERVICE_PRECONDITION: "namenode:9870 datanode1:9864 datanode2:9864 datanode3:9864 datanode4:9864" env_file: - ./hadoop.env depends_on: - namenode - datanode1 - datanode2 - datanode3 - datanode4 nodemanager1: image: bde2020/hadoop-nodemanager:2.0.0-hadoop3.1.3-java8 container_name: nodemanager environment: SERVICE_PRECONDITION: "namenode:9870 datanode1:9864 datanode2:9864 datanode3:9864 datanode4:9864 resourcemanager:8088" env_file: - ./hadoop.env depends_on: - namenode - datanode1 - datanode2 - datanode3 - datanode4 historyserver: image: bde2020/hadoop-historyserver:2.0.0-hadoop3.1.3-java8 container_name: historyserver environment: SERVICE_PRECONDITION: "namenode:9870 datanode1:9864 datanode2:9864 datanode3:9864 datanode4:9864 resourcemanager:8088" volumes: - hadoop_historyserver:/hadoop/yarn/timeline env_file: - ./hadoop.env depends_on: - namenode - datanode1 - datanode2 - datanode3 - datanode4 volumes: hadoop_namenode: hadoop_datanode1: hadoop_datanode2: hadoop_datanode3: hadoop_datanode4: hadoop_historyserver:
docker-compose up