Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Added functionality to run.sh in docker/generic #1617

Merged
merged 6 commits into from
Nov 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions docker/generic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ $ sh build.sh kinetic

## How to Run
```
# Default shared directory path is /home/$USER/shared_dir

# Ubuntu 14.04 (Indigo)
$ sh run.sh indigo
$ ./run.sh -t latest-indigo

# Ubuntu 16.04 (Kinetic)
$ sh run.sh kinetic

# If you select your shared directory path
$ sh run.sh indigo|kinetic {SHARED_DIR_PATH}
$ ./run.sh -t latest-kinetic
```

|Option|Default|Description|
|---|---|---|
|-h||Show `Usage: $0 [-t <tag>] [-r <repo>] [-s <Shared directory>]`|
|-t|latest-kinetic|Specify tag|
|-r|autoware/autoware|Specify repo|
|-s|/home/$USER/shared_dir|Specify shared dir|
49 changes: 33 additions & 16 deletions docker/generic/run.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,42 @@
#!/bin/sh
#!/bin/bash

usage() { echo "Usage: $0 [-t <tag>] [-r <repo>] [-s <Shared directory>]" 1>&2; exit 1; }

# Defaults
XSOCK=/tmp/.X11-unix
XAUTH=/home/$USER/.Xauthority
SHARED_DIR=/home/autoware/shared_dir
HOST_DIR=/home/$USER/shared_dir
DOCKER_HUB_REPO="autoware/autoware"
TAG="latest-kinetic"

if [ "$1" = "kinetic" ] || [ "$1" = "indigo" ]
then
echo "Use $1"
else
echo "Select distribution, kinetic|indigo"
exit
fi
while getopts ":ht:r:s:" opt; do
case $opt in
h)
usage
exit
;;
t)
TAG=$OPTARG
;;
r )
DOCKER_HUB_REPO=$OPTARG
;;
s)
HOST_DIR=$OPTARG
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done

if [ "$2" = "" ]
then
# Create Shared Folder
mkdir -p $HOST_DIR
else
HOST_DIR=$2
fi
echo "Using $DOCKER_HUB_REPO:$TAG"
echo "Shared directory: ${HOST_DIR}"

nvidia-docker run \
Expand All @@ -32,4 +49,4 @@ nvidia-docker run \
-u autoware \
--privileged -v /dev/bus/usb:/dev/bus/usb \
--net=host \
autoware-$1
$DOCKER_HUB_REPO:$TAG