Skip to content

Instantly share code, notes, and snippets.

@mvillarrealb
Last active November 10, 2019 14:31
Show Gist options
  • Save mvillarrealb/91005b6fa20f5fd8ea50e3406fb9adae to your computer and use it in GitHub Desktop.
Save mvillarrealb/91005b6fa20f5fd8ea50e3406fb9adae to your computer and use it in GitHub Desktop.
A custom docker image based on spark-base:2.3.1 image, used to create a spark master containers
FROM spark-base:2.3.1
COPY start-master.sh /
ENV SPARK_MASTER_PORT 7077
ENV SPARK_MASTER_WEBUI_PORT 8080
ENV SPARK_MASTER_LOG /spark/logs
EXPOSE 8080 7077 6066
CMD ["/bin/bash", "/start-master.sh"]
#!/bin/bash
export SPARK_MASTER_HOST=`hostname`
. "/spark/sbin/spark-config.sh"
. "/spark/bin/load-spark-env.sh"
mkdir -p $SPARK_MASTER_LOG
export SPARK_HOME=/spark
ln -sf /dev/stdout $SPARK_MASTER_LOG/spark-master.out
cd /spark/bin && /spark/sbin/../bin/spark-class org.apache.spark.deploy.master.Master --ip $SPARK_MASTER_HOST --port $SPARK_MASTER_PORT --webui-port $SPARK_MASTER_WEBUI_PORT >> $SPARK_MASTER_LOG/spark-master.out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment