1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
#!/bin/bash
HOSTDIR=$(pwd)
INIT_MARKER=$HOSTDIR/hdfs-initialized-indicator
# Remove initialization marker
rm -f $INIT_MARKER
# Start the hdfs service
echo "Starting Docker Container..."
CONTAINER_ID=$(docker run -d -v $(pwd):/working daskdev/dask-hdfs-testing)
export CONTAINER_ID
# Error immediately if this fails
if [ $? -ne 0 ]; then
echo "Failed starting HDFS container"
exit 1
fi
echo "DONE"
# Wait for initialization
CHECK_RUNNING="docker top $CONTAINER_ID"
while [[ $($CHECK_RUNNING) ]] && [[ ! -f $INIT_MARKER ]]
do
sleep 1
done
# Error out if the container failed starting
if [[ ! $($CHECK_RUNNING) ]]; then
echo "HDFS startup failed! Logs follow"
echo "-------------------------------------------------"
docker logs $CONTAINER_ID
echo "-------------------------------------------------"
exit 1
fi
echo "Started HDFS container: $CONTAINER_ID"
|