249
|
1 #!/bin/bash
|
|
2 set -e
|
|
3
|
|
4 # first arg is `-f` or `--some-option`
|
|
5 if [ "${1#-}" != "$1" ]; then
|
|
6 set -- docker "$@"
|
|
7 fi
|
|
8
|
|
9 # if our command is a valid Docker subcommand, let's invoke it through Docker instead
|
|
10 # (this allows for "docker run docker ps", etc)
|
|
11 if docker help "$1" > /dev/null 2>&1; then
|
|
12 set -- docker "$@"
|
|
13 fi
|
|
14
|
|
15 # if we have "--link some-docker:docker" and not DOCKER_HOST, let's set DOCKER_HOST automatically
|
|
16 if [ -z "$DOCKER_HOST" -a "$DOCKER_PORT_2375_TCP" ]; then
|
|
17 export DOCKER_HOST='tcp://docker:2375'
|
|
18 fi
|
|
19
|
|
20 if [ "$1" = 'dockerd' ]; then
|
|
21 cat >&2 <<-'EOW'
|
|
22 📎 Hey there! It looks like you're trying to run a Docker daemon.
|
|
23 You probably should use the "dind" image variant instead, something like:
|
|
24 docker run --privileged --name some-overlay-docker -d docker:stable-dind --storage-driver=overlay
|
|
25 See https://hub.docker.com/_/docker/ for more documentation and usage examples.
|
|
26 EOW
|
|
27 sleep 3
|
|
28 fi
|
|
29
|
|
30 exec "$@"
|