annotate bamboo-agent/docker-entrypoint.sh @ 469:94794d74caa9

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