Minor changes to base Dockerfile:

- Using debian:12-slim instead of base image
- Added netcat-openbsd in installed packages which is needed for healthcheck
- Added HADOOP_OPTS env for resourcemanager container
- Changed env USER=hdoop from USER=root
- Added useradd anc chown commands for hdoop user
This commit is contained in:
K
2025-04-13 02:44:31 +05:30
parent 074a0a48c4
commit d2e0fb60fa
2 changed files with 75 additions and 23 deletions
+21 -2
View File
@@ -1,5 +1,5 @@
# Base image: Debian-12
FROM debian:12
FROM debian:12-slim
# Update local package index, upgrade packages and install required packages.
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
@@ -7,6 +7,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins
net-tools \
curl \
gnupg \
netcat-openbsd \
&& rm -rf /var/lib/apt/lists/*
# Set Java env
@@ -39,15 +40,33 @@ RUN mkdir /opt/hadoop-$HADOOP_VERSION/logs /hadoop-data
# Set env
ENV HADOOP_HOME=/opt/hadoop-$HADOOP_VERSION
ENV HADOOP_CONF_DIR=/etc/hadoop
ENV HADOOP_OPTS="--add-opens java.base/java.lang=ALL-UNNAMED"
ENV MULTIHOMED_NETWORK=1
ENV USER=root
ENV USER=hdoop
ENV PATH $HADOOP_HOME/bin/:$PATH
# Ensure required config files exist
# RUN mkdir -p /etc/hadoop && \
# echo "<configuration></configuration>" > /etc/hadoop/core-site.xml && \
# echo "<configuration></configuration>" > /etc/hadoop/hdfs-site.xml && \
# echo "<configuration></configuration>" > /etc/hadoop/yarn-site.xml && \
# echo "<configuration></configuration>" > /etc/hadoop/mapred-site.xml && \
# echo "<configuration></configuration>" > /etc/hadoop/httpfs-site.xml && \
# echo "<configuration></configuration>" > /etc/hadoop/kms-site.xml
# Create non-root user
RUN useradd -m -s /bin/bash hdoop
# Copy entrypoint.sh to container
ADD entrypoint.sh /entrypoint.sh
# Set ownership for Hadoop dirs
RUN chown -R hdoop:hdoop /opt/hadoop-$HADOOP_VERSION /etc/hadoop /hadoop-data
# Make entrypoint.sh executable
RUN chmod a+x /entrypoint.sh
USER hdoop
# Specify entrypoint
ENTRYPOINT ["/entrypoint.sh"]