@@ -13,6 +13,7 @@ if [ -n "${DEVA_DOCKER_TAG+x}" ]; then
1313 DEVA_DOCKER_TAG_ENV_SET=true
1414fi
1515
16+ VERSION=" 0.8.0"
1617DEVA_DOCKER_IMAGE=" ${DEVA_DOCKER_IMAGE:- ghcr.io/ thevibeworks/ deva} "
1718DEVA_DOCKER_TAG=" ${DEVA_DOCKER_TAG:- latest} "
1819DEVA_CONTAINER_PREFIX=" ${DEVA_CONTAINER_PREFIX:- deva} "
@@ -1447,6 +1448,11 @@ if [ ${#PRE_ARGS[@]} -gt 0 ]; then
14471448 usage
14481449 exit 0
14491450 ;;
1451+ --version)
1452+ echo " deva.sh v${VERSION} "
1453+ echo " Docker Image: ${DEVA_DOCKER_IMAGE} :${DEVA_DOCKER_TAG} "
1454+ exit 0
1455+ ;;
14501456 --show-config)
14511457 MANAGEMENT_MODE=" show-config"
14521458 ;;
@@ -2127,24 +2133,32 @@ if [ "$EPHEMERAL_MODE" = false ]; then
21272133 else
21282134 # Container doesn't exist - try to create it
21292135 echo " Creating persistent container: $CONTAINER_NAME "
2130- if ! docker " ${DOCKER_ARGS[@]} " tail -f /dev/null > /dev/null 2>&1 ; then
2131- # Creation failed - likely name collision from concurrent run
2132- # Wait for the other process to finish creating the container
2133- echo " Container name in use, waiting for initialization..."
2134- timeout=10
2135- while [ $timeout -gt 0 ]; do
2136- if docker ps -q --filter " name=^${CONTAINER_NAME} $" | grep -q . ; then
2137- echo " Container ready, attaching..."
2138- break
2136+ error_output=$( docker " ${DOCKER_ARGS[@]} " tail -f /dev/null 2>&1 )
2137+ docker_exit=$?
2138+ if [ $docker_exit -ne 0 ]; then
2139+ # Check if specifically a name collision (concurrent run)
2140+ if echo " $error_output " | grep -qE ' already in use|Conflict' ; then
2141+ echo " Container name in use, waiting for initialization..."
2142+ attempts=20 # 20 * 0.5s = 10s total
2143+ while [ $attempts -gt 0 ]; do
2144+ if docker ps -q --filter " name=^${CONTAINER_NAME} $" 2> /dev/null | grep -q . ; then
2145+ echo " Container ready, attaching..."
2146+ break
2147+ fi
2148+ sleep 0.5
2149+ attempts=$(( attempts - 1 ))
2150+ done
2151+ if [ $attempts -eq 0 ]; then
2152+ echo " error: timed out waiting for container $CONTAINER_NAME " >&2
2153+ exit 1
21392154 fi
2140- sleep 0.5
2141- timeout= $(( timeout - 1 ))
2142- done
2143- if [ $timeout -eq 0 ] ; then
2144- echo " error: timed out waiting for container $CONTAINER_NAME " >&2
2155+ container_action= " attach "
2156+ else
2157+ # Real error - surface immediately
2158+ echo " error: failed to create container $CONTAINER_NAME : " >&2
2159+ echo " $error_output " >&2
21452160 exit 1
21462161 fi
2147- container_action=" attach"
21482162 else
21492163 sleep 0.3
21502164 container_action=" create"
0 commit comments