forked from mdouchement/docker-hdfs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
61 lines (48 loc) · 1.69 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
55
56
57
58
59
60
61
FROM openjdk:8-slim
MAINTAINER Pravega Team
ENV DEBIAN_FRONTEND noninteractive
ARG HADOOP_VERSION=2.7.7
# Refresh package lists
RUN apt-get update && apt-get install -y --no-install-recommends apt-utils
RUN apt-get -y upgrade
RUN apt-get install -qy rsync curl openssh-server openssh-client vim nfs-common netcat
RUN mkdir -p /data/hdfs-nfs/
RUN mkdir -p /opt
WORKDIR /opt
# Install Hadoop
RUN curl -L https://archive.apache.org/dist/hadoop/core/hadoop-$HADOOP_VERSION/hadoop-$HADOOP_VERSION.tar.gz -s -o - | tar -xzf -
RUN mv hadoop-$HADOOP_VERSION hadoop
# Setup
WORKDIR /opt/hadoop
ENV PATH /opt/hadoop/bin:/opt/hadoop/sbin:$PATH
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
RUN sed --in-place='.ori' -e "s/\${JAVA_HOME}/\/usr\/lib\/jvm\/java-8-openjdk-amd64/" etc/hadoop/hadoop-env.sh
# Configure ssh client
RUN ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa && \
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys && \
chmod 0600 ~/.ssh/authorized_keys
RUN echo "\nHost *\n" >> ~/.ssh/config && \
echo " StrictHostKeyChecking no\n" >> ~/.ssh/config && \
echo " UserKnownHostsFile=/dev/null\n" >> ~/.ssh/config
# Disable sshd authentication
RUN echo "root:root" | chpasswd
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# Pseudo-Distributed Operation
COPY etc/hadoop/core-site.xml etc/hadoop/core-site.xml
COPY etc/hadoop/hdfs-site.xml etc/hadoop/hdfs-site.xml
RUN hdfs namenode -format
ADD entrypoint.sh /entrypoint.sh
RUN chmod 700 /entrypoint.sh
# SSH
EXPOSE 22
# hdfs://localhost:8020
EXPOSE 8020
# HDFS namenode
EXPOSE 50020
# HDFS Web browser
EXPOSE 50070
# HDFS datanodes
EXPOSE 50075
# HDFS secondary namenode
EXPOSE 50090
CMD ["/entrypoint.sh", "-d"]