blob: da44219dedf89ba4d1ab524a8ba8b0eb80b5e385 [file] [log] [blame]
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
if [ -z "$MY_PATH" ] ; then
# error; for some reason, the path is not accessible
# to the script (e.g. permissions re-evaled after suid)
exit 1 # fail
fi
WORKING_DIR=$2
if [ -z "$WORKING_DIR" ]; then
WORKING_DIR="$(pwd)"
fi
docker run -it --rm -e UID=$(id -u) -u $(id -u):$(id -g) -v $WORKING_DIR:/home/user -w /home/user -e USERNAME=$USERNAME -e USER=$USER -e USERID=$UID $1:latest /bin/bash