github.com/devtron-labs/ci-runner@v0.0.0-20240518055909-b2672f3349d7/dockerd-entrypoint.sh (about)

     1  #!/bin/sh
     2  set -e
     3  
     4  # no arguments passed
     5  # or first arg is `-f` or `--some-option`
     6  if [ "$#" -eq 0 ] || [ "${1#-}" != "$1" ]; then
     7  	# add our default arguments
     8  	set -- dockerd \
     9  		--host=unix:///var/run/docker.sock \
    10  		--host=tcp://0.0.0.0:2375 \
    11  		"$@"
    12  fi
    13  
    14  if [ "$1" = 'dockerd' ]; then
    15  	if [ -x '/usr/local/bin/dind' ]; then
    16  		# if we have the (mostly defunct now) Docker-in-Docker wrapper script, use it
    17  		set -- '/usr/local/bin/dind' "$@"
    18  	fi
    19  
    20  	# explicitly remove Docker's default PID file to ensure that it can start properly if it was stopped uncleanly (and thus didn't clean up the PID file)
    21  	find /run /var/run -iname 'docker*.pid' -delete
    22  fi
    23  
    24  exec "$@"