Put this in your .bashrc
.zshrc
or whatever shell you are using.
function runDockerfile() {
local file="${1:-Dockerfile}"
if [ ! -f $file ] ; then
echo "$file is not there, aborting."
return
fi
docker build . -f $file -t temp-image
docker run ${@:2} temp-image
}
runDockerfile="runDockerfile"
Now you can e.g.
runDockerfile Dockerfile-runtime -u "nobody"
And it will build and start the Dockerfile-runtime
Dockerfile and add -u "nobody"
to the run command.