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 .