Hadoop的Docker镜像构建

Posted Hendsame

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Hadoop的Docker镜像构建相关的知识,希望对你有一定的参考价值。

1、Dockerfile

###Dockerfile   -- beagin
FROM ubuntu:trusty
#MAINTAINER The Hue Team "https://github.com/cloudera/hue"

RUN apt-get update -y

RUN apt-get install -y software-properties-common
RUN add-apt-repository -y ppa:webupd8team/java
RUN apt-get update -y

RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
RUN apt-get install -y oracle-java8-installer

RUN apt-get update -y
RUN apt-get install --fix-missing -q -y   git   ant   gcc   g++   libkrb5-dev   libmysqlclient-dev   libssl-dev   libsasl2-dev   libsasl2-modules-gssapi-mit   libsqlite3-dev   libtidy-0.99-0   libxml2-dev   libxslt-dev   libffi-dev   make   maven   libldap2-dev   python-dev   python-setuptools   libgmp3-dev   libz-dev
#Download Hadoop from one of these mirrors. Change the version number appropriately:
RUN wget http://apache.mirrors.tds.net/hadoop/common/hadoop-2.7.2/hadoop-2.7.2.tar.gz -P ~/Downloads
#Extract it to /usr/local:
RUN tar zxvf ~/Downloads/hadoop-* -C /usr/local
#Rename the directory to just hadoop:
RUN mv /usr/local/hadoop-* /usr/local/hadoop
###Dockerfile   -- end

2、修改配置

#Set Environment Variables
#Find Java with:
#readlink -f $(which java)
#Environment variables:
$ echo "export JAVA_HOME=/usr/lib/jvm/java-8-oracle" >> ~/.bashrc
#$ source ~/.bashrc

$ echo "export PATH=$PATH:$JAVA_HOME/bin" >> ~/.bashrc
#$ source ~/.bashrc

$ echo "export HADOOP_HOME=/usr/local/hadoop" >> ~/.bashrc
#$ source ~/.bashrc

$ echo "export PATH=$PATH:$HADOOP_HOME/bin" >> ~/.bashrc
#$ source ~/.bashrc

$ echo "export HADOOP_CONF_DIR=/usr/local/hadoop/etc/hadoop" >> ~/.bashrc
$ source ~/.bashrc

3、构建镜像

docker build -t hadoop .

 

以上是关于Hadoop的Docker镜像构建的主要内容,如果未能解决你的问题,请参考以下文章

docker快速搭建hadoop集群(2023.3.27)

docker搭建hadoop2.8.5

Hadoop Yarn on Docker

在Docker中跑Hadoop与镜像制作

入门、快速搭建Docker分布式项目环境

使用 docker 一键搭建 hadoop,hbase, hive 等大数据集群