Added a 'runjessie' tool to run commands inside a jessie container
This commit is contained in:
parent
79af572ae4
commit
9dd49bb733
1 changed files with 17 additions and 0 deletions
17
tools/runjessie
Executable file
17
tools/runjessie
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
MOUNT_PATH="/tmp/data"
|
||||
CURRENT_DIRECTORY=`pwd -P` # untangle symbolic links if needed
|
||||
USERNAME=`whoami`
|
||||
IMAGE="debian:jessie"
|
||||
|
||||
if [[ -z $1 ]]; then
|
||||
echo "usage: `basename $0` command_to_run_inside_a_container"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
RESOLVED_ARGUMENTS="$@"
|
||||
docker run -i -t -v "$CURRENT_DIRECTORY":"$MOUNT_PATH":Z $IMAGE bash -c "useradd -M -d $MOUNT_PATH $USERNAME 2>&1 > /dev/null && bash -c '$RESOLVED_ARGUMENTS'"
|
||||
|
||||
# restore SELinux context for the current directory
|
||||
restorecon -R "$CURRENT_DIRECTORY"
|
||||
|
Loading…
Reference in a new issue