-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src/snabb wrapper when building container snabb
- Loading branch information
Showing
3 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/sh | ||
|
||
name=$(basename $0) | ||
if [ ".$name" == ".launch-docker-container.sh" ]; then | ||
cat <<EOF | ||
$0 | ||
please link this script to the container image you like to run | ||
e.g. to launch latest alpine image with the current working directory mounted: | ||
$ ln -s launch-docker-container.sh alpine | ||
$ ./alpine | ||
/u # ls | ||
alpine launch-docker-container.sh | ||
/u # uname -a | ||
Linux 68b18fa5b4d4 4.9.75-linuxkit-aufs #1 SMP Tue Jan 9 10:58:17 UTC 2018 x86_64 Linux | ||
/u # exit | ||
It also accept arguments: | ||
$ alpine uname -a | ||
Linux 3b18ba5282f3 4.9.75-linuxkit-aufs #1 SMP Tue Jan 9 10:58:17 UTC 2018 x86_64 Linux | ||
$ | ||
EOF | ||
exit 1 | ||
fi | ||
|
||
img=$(docker images -q $name) | ||
if [ -z "$img" ]; then | ||
echo "docker image $name doesn't exist" | ||
fi | ||
|
||
exec docker run -ti --rm -v ${PWD}:/u --workdir /u $name $@ |