doxgxxn / data_TIL

toy project dumster and daily review of everything
1 stars 0 forks source link

230914 / review dockerfile #23

Open doxgxxn opened 1 year ago

doxgxxn commented 1 year ago
FROM ubuntu:22.04
RUN apt update
RUN apt install -y openssh-server
RUN apt install -y openssh-client
RUN apt install -y pdsh
RUN apt-get install -y vim
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/gi' /etc/ssh/sshd_config

RUN ssh-keygen -t rsa -N '' -f /root/.ssh/id_rsa 
RUN cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
RUN chmod 0600 ~/.ssh/authorized_keys
RUN echo "ssh" > /etc/pdsh/rcmd_default
RUN apt install -y openjdk-8-jdk
RUN mkdir /root/hadoop
RUN wget https://archive.apache.org/dist/hadoop/common/hadoop-3.3.4/hadoop-3.3.4.tar.gz -P /root/hadoop
RUN tar zxvf /root/hadoop/hadoop-3.3.4.tar.gz -C /root/hadoop --strip 1
RUN echo "export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64" >> /root/hadoop/etc/hadoop/hadoop-env.sh
RUN sed -i '20d' /root/hadoop/etc/hadoop/core-site.xml
RUN printf  "<property>\n\
             <name>fs.defaultFS</name>\n\
             <value>hdfs://localhost:9000</value>\n\
             </property>\n\
            <property>\n\
             <name>dfs.replication</name>\n\
             <value>1</value>\n\
          </property>\n\
          </configuration>" >> /root/hadoop/etc/hadoop/core-site.xml

RUN printf  "export HADOOP_HOME=\"/root/hadoop\"\n\
export PATH=\$PATH:\$HADOOP_HOME/bin\n\
export PATH=\$PATH:\$HADOOP_HOME/sbin\n\
export HADOOP_MAPRED_HOME=\$HADOOP_HOME\n\
export HADOOP_COMMON_HOME=\$HADOOP_HOME\n\
export HADOOP_HDFS_HOME=\$HADOOP_HOME\n\
export YARN_HOME=\$HADOOP_HOME\n\

export HDFS_NAMENODE_USER=\"root\"\n\
export HDFS_DATANODE_USER=\"root\"\n\
export HDFS_SECONDARYNAMENODE_USER=\"root\"\n\
export YARN_RESOURCEMANAGER_USER=\"root\"\n\
export YARN_NODEMANAGER_USER=\"root\"" >> /root/.bashrc

RUN /bin/bash -c "source /root/.bashrc"

RUN sed -i '21d' /root/hadoop/etc/hadoop/mapred-site.xml

RUN printf  "<property>\n\
            <name>mapreduce.framework.name</name>\n\
              <value>yarn</value>\n\
        </property>\n\
        <property>\n\
            <name>yarn.app.mapreduce.am.env</name>\n\
            <value>HADOOP_MAPRED_HOME=/root/hadoop</value>\n\
        </property>\n\
        <property>\n\
            <name>mapreduce.map.env</name>\n\
             <value>HADOOP_MAPRED_HOME=/root/hadoop</value>\n\
        </property>\n\
        <property>\n\
            <name>mapreduce.reduce.env</name>\n\
            <value>HADOOP_MAPRED_HOME=/root/hadoop</value>\n\
        </property></configuration>" >> /root/hadoop/etc/hadoop/mapred-site.xml

RUN sed -i '19d' /root/hadoop/etc/hadoop/yarn-site.xml
RUN printf  "<property>\n\
                <name>yarn.nodemanager.aux-services</name>\n\
                <value>mapreduce_shuffle</value>\n\
            </property>\n\
            <property>\n\
                <name>yarn.nodemanager.vmem-check-enabled</name>\n\
                <value>false</value>\n\
            </property>\n\
            </configuration>\n"  >> /root/hadoop/etc/hadoop/yarn-site.xml