-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
54 lines (43 loc) · 1.78 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
FROM jk9527/hadoop:jdk-8u271
# pre-installed package
RUN apt-get update && apt-get upgrade -y \
&& apt-get install -y rsync openssh-server wget \
&& ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa \
&& cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
WORKDIR /opt
USER root
# hadoop env
ENV HADOOP_FILE_NAME="hadoop-2.10.1"
ENV HADOOP_NODE_PATH="/root/hdfs"
ENV HADOOP_HOME=/opt/hadoop
ENV HADOOP_MAPRED_HOME=${HADOOP_HOME}
ENV PATH ${HADOOP_HOME}/sbin:${HADOOP_HOME}/bin:${PATH}
ENV YARN_PID_DIR=/root/yarn_pid_dir
# install hadoop
RUN wget -O ${HADOOP_FILE_NAME}.tar.gz "https://downloads.apache.org/hadoop/common/${HADOOP_FILE_NAME}/${HADOOP_FILE_NAME}.tar.gz" \
# RUN wget -O ${HADOOP_FILE_NAME}.tar.gz "https://apache.claz.org/hadoop/common/${HADOOP_FILE_NAME}/${HADOOP_FILE_NAME}.tar.gz" \
&& tar -xzvf ${HADOOP_FILE_NAME}.tar.gz \
&& rm ${HADOOP_FILE_NAME}.tar.gz \
&& mv ${HADOOP_FILE_NAME} hadoop
# init node dir
RUN mkdir -p ~/hdfs/namenode \
&& mkdir -p ~/hdfs/datanode \
&& mkdir $HADOOP_HOME/logs \
&& mkdir $YARN_PID_DIR
# backup conf
# RUN cp -r ${HADOOP_HOME}/etc/hadoop /opt/conf_backup \
# && tar -czvf conf_backup.tar.gz ./conf_backup \
# && rm -r ./conf_backup
# install zookeeper
ENV ZOOKEEPER_HOME=/opt/zookeeper
ENV PATH ${ZOOKEEPER_HOME}/bin:${PATH}
RUN wget https://downloads.apache.org/zookeeper/zookeeper-3.6.2/apache-zookeeper-3.6.2-bin.tar.gz \
# RUN wget https://apache.claz.org/zookeeper/zookeeper-3.6.2/apache-zookeeper-3.6.2-bin.tar.gz \
&& tar -xzvf apache-zookeeper-3.6.2-bin.tar.gz \
&& rm apache-zookeeper-3.6.2-bin.tar.gz \
&& mv apache-zookeeper-3.6.2-bin zookeeper
# set config
COPY conf/ssh/ssh_config /etc/ssh/ssh_config
COPY scripts ./scripts
EXPOSE 2181 2888 3888 8080
ENTRYPOINT ["/bin/bash", "./scripts/entrypoint.sh"]