From 764ae807e07f4e28a37dc9eba70a51037c60293c Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Mon, 30 Nov 2015 20:56:25 -0600 Subject: [PATCH] Avoid text file busy prior to exec sudo --- minecraft-server/Dockerfile | 2 +- minecraft-server/start.sh | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/minecraft-server/Dockerfile b/minecraft-server/Dockerfile index d57baa27..e1f8a32f 100644 --- a/minecraft-server/Dockerfile +++ b/minecraft-server/Dockerfile @@ -5,7 +5,7 @@ MAINTAINER itzg ENV APT_GET_UPDATE 2015-10-03 RUN apt-get update -RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libmozjs-24-bin imagemagick && apt-get clean +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libmozjs-24-bin imagemagick lsof && apt-get clean RUN update-alternatives --install /usr/bin/js js /usr/bin/js24 100 RUN wget -O /usr/bin/jsawk https://github.com/micha/jsawk/raw/master/jsawk diff --git a/minecraft-server/start.sh b/minecraft-server/start.sh index 47be882b..7d57aca1 100755 --- a/minecraft-server/start.sh +++ b/minecraft-server/start.sh @@ -4,5 +4,9 @@ set -e usermod --uid $UID minecraft chown -R minecraft /data /start-minecraft +while lsof -- /start-minecraft; do + echo -n "." + sleep 1 +done +echo "...switching to user 'minecraft'" exec sudo -E -u minecraft /start-minecraft -