hyunsoolee0506/scalaspark:3.5.0
로 이미지 이름을 생성한다.# base image
FROM ubuntu:20.04
WORKDIR /workspace
# User setting
USER root
# Install python
RUN apt-get update && \
apt-get install -y python3 python3-pip && \
rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install wget -y
# Ignore interactive action while building docker images
ARG DEBIAN_FRONTEND=noninteractive
# Install spark relative packages
RUN apt-get install openjdk-11-jdk -y
RUN pip3 install findspark && pip3 install pyspark==3.5.0
RUN wget https://dlcdn.apache.org/spark/spark-3.5.0/spark-3.5.0-bin-hadoop3.tgz && tar -xvzf spark-3.5.0-bin-hadoop3.tgz && rm -rf spark-3.5.0-bin-hadoop3.tgz
# Install scala kernel
RUN pip3 install jupyterlab && pip3 install spylon-kernel && python3 -m spylon_kernel install
# ENV setting
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
ENV SPARK_HOME=/workspace/spark-3.5.0-bin-hadoop3
# Jupyter workspace
WORKDIR /workspace/spark
# Expose port
EXPOSE 8888
# Initial command
CMD ["jupyter", "lab", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--allow-root"]
docker build -t hyunsoolee0506/scalaspark:3.5.0 .
docker run -d -p 8888:8888 -v [로컬경로]:/workspace/spark hyunsoolee0506/scalaspark:3.5.0