HADOOP-17298. Backslash in username causes build failure in the environment started by start-build-env.sh. (#2367)
Signed-off-by: Akira Ajisaka <aajisaka@apache.org>
(cherry picked from commit a2e7a073f0
)
This commit is contained in:
parent
37c2e34b02
commit
0289cdc43c
@ -66,13 +66,16 @@ if [ "$(uname -s)" = "Linux" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Set the home directory in the Docker container.
|
||||
DOCKER_HOME_DIR=${DOCKER_HOME_DIR:-/home/${USER_NAME}}
|
||||
|
||||
docker build -t "hadoop-build-${USER_ID}" - <<UserSpecificDocker
|
||||
FROM hadoop-build
|
||||
RUN rm -f /var/log/faillog /var/log/lastlog
|
||||
RUN groupadd --non-unique -g ${GROUP_ID} ${USER_NAME}
|
||||
RUN useradd -g ${GROUP_ID} -u ${USER_ID} -k /root -m ${USER_NAME}
|
||||
RUN useradd -g ${GROUP_ID} -u ${USER_ID} -k /root -m ${USER_NAME} -d "${DOCKER_HOME_DIR}"
|
||||
RUN echo "${USER_NAME} ALL=NOPASSWD: ALL" > "/etc/sudoers.d/hadoop-build-${USER_ID}"
|
||||
ENV HOME /home/${USER_NAME}
|
||||
ENV HOME "${DOCKER_HOME_DIR}"
|
||||
|
||||
UserSpecificDocker
|
||||
|
||||
@ -85,9 +88,9 @@ DOCKER_INTERACTIVE_RUN=${DOCKER_INTERACTIVE_RUN-"-i -t"}
|
||||
# system. And this also is a significant speedup in subsequent
|
||||
# builds because the dependencies are downloaded only once.
|
||||
docker run --rm=true $DOCKER_INTERACTIVE_RUN \
|
||||
-v "${PWD}:/home/${USER_NAME}/hadoop${V_OPTS:-}" \
|
||||
-w "/home/${USER_NAME}/hadoop" \
|
||||
-v "${HOME}/.m2:/home/${USER_NAME}/.m2${V_OPTS:-}" \
|
||||
-v "${HOME}/.gnupg:/home/${USER_NAME}/.gnupg${V_OPTS:-}" \
|
||||
-v "${PWD}:${DOCKER_HOME_DIR}/hadoop${V_OPTS:-}" \
|
||||
-w "${DOCKER_HOME_DIR}/hadoop" \
|
||||
-v "${HOME}/.m2:${DOCKER_HOME_DIR}/.m2${V_OPTS:-}" \
|
||||
-v "${HOME}/.gnupg:${DOCKER_HOME_DIR}/.gnupg${V_OPTS:-}" \
|
||||
-u "${USER_ID}" \
|
||||
"hadoop-build-${USER_ID}" "$@"
|
||||
|
Loading…
Reference in New Issue
Block a user