| ... | ... |
@@ -1,5 +1,14 @@ |
| 1 | 1 |
#!/bin/bash |
| 2 | 2 |
|
| 3 |
+# DinD: a wrapper script which allows docker to be run inside a docker container. |
|
| 4 |
+# Original version by Jerome Petazzoni <jerome@dotcloud.com> |
|
| 5 |
+# See the blog post: http://blog.docker.io/2013/09/docker-can-now-run-within-docker/ |
|
| 6 |
+# |
|
| 7 |
+# This script should be executed inside a docker container in privilieged mode |
|
| 8 |
+# ('docker run -privileged', introduced in docker 0.6).
|
|
| 9 |
+ |
|
| 10 |
+# Usage: dind CMD [ARG...] |
|
| 11 |
+ |
|
| 3 | 12 |
# First, make sure that cgroups are mounted correctly. |
| 4 | 13 |
CGROUP=/sys/fs/cgroup |
| 5 | 14 |
|
| ... | ... |
@@ -44,13 +53,4 @@ do |
| 44 | 44 |
done |
| 45 | 45 |
popd |
| 46 | 46 |
|
| 47 |
-# If we were given a PORT environment variable, start as a simple daemon; |
|
| 48 |
-# otherwise, spawn a shell as well |
|
| 49 |
-if [ "$PORT" ] |
|
| 50 |
-then |
|
| 51 |
- exec docker -d -H 0.0.0.0:$PORT |
|
| 52 |
-else |
|
| 53 |
- |
|
| 54 |
- docker -d & |
|
| 55 |
- exec bash |
|
| 56 |
-fi |
|
| 47 |
+exec $* |