7

在运行 docker image 时,我收到以下错误:

/entrypoint.sh: line 7: USER: unbound variable 

entrypoint.sh 的代码。

    #!/bin/bash
set -euo pipefail

export SPARK_DIST_CLASSPATH=$(hadoop classpath)
POSTGRES_TIMEOUT=60

echo "Running as: ${USER}"
if [ "${USER}" != "root" ]; then
  echo "Changing owner of files in ${AIRFLOW_HOME} to ${USER}"
  chown -R "${USER}" ${AIRFLOW_HOME}
fi

set +e

Docker 文件中环境变量用户声明:

# Delay creation of user and group
ONBUILD ARG THEUSER=afpuser
ONBUILD ARG THEGROUP=hadoop

ONBUILD ENV USER ${THEUSER}
ONBUILD ENV GROUP ${THEGROUP}
ONBUILD RUN groupadd -r "${GROUP}" && useradd -rmg "${GROUP}" "${USER}"

Docker 镜像的完整代码在链接中

4

0 回答 0