browser-box: allow users to force launch a browser in a container

pull/3/merge
Sameer Naik 9 years ago
parent f32960d8ac
commit 451257c6f1

@ -81,7 +81,7 @@ This will install wrapper scripts to launch:
> **Note**
>
> If the application being launched is already installed on the host, then the host command is executed and the docker image is not started.
> If the browser is installed on the the host then it is launched instead of starting it in a docker container. To force the launch a browser in a container, launch the browser using the `browser-box` script. For example, `browser-box firefox` will launch the Firefox browser inside a Docker container regardless of whether Firefox is installed on the host or not.
## Use Cases

@ -11,9 +11,6 @@ USER_GID=$(id -g)
XSOCK=/tmp/.X11-unix
XAUTH=/tmp/.docker.xauth
prog=$(basename $0)
exec=$(which $prog)
list_browsers() {
echo "Launch a browser using:"
echo " chromium-browser - Launch Chromium"
@ -73,13 +70,21 @@ prepare_docker_device_parameters() {
done
}
if [[ $prog == "browser-box" ]]; then
list_browsers
exit 1
fi
# launch host binary if it exists
if [[ -n ${exec} ]]; then
prog=$(basename $0)
exec=$(which $prog)
if [[ ${prog} == "browser-box" ]]; then
case ${1} in
google-chrome|google-chrome-stable|tor-browser|chromium-browser|firefox)
prog=${1}
shift
;;
*|help)
list_browsers
exit 1
;;
esac
elif [[ -n ${exec} ]]; then
# launch host binary if it exists
exec ${exec} $@
fi

Loading…
Cancel
Save