# Run once, hold otherwise
if [ -f "already_ran" ]; then
echo "Already ran the Entrypoint once. Holding indefinitely for debugging."
cat
fi
touch already_ran
# Do your main things down here
为了确保cat保存连接,你可能需要提供一个TTY。我用我的入口点脚本运行容器,就像这样:
docker run -t --entrypoint entrypoint.sh image_name