S6 overlay bash script command substitution warning: ignored null byte in input

I have a Alpine-based docker container that runs an AdonisJS program that uses an external database. As part of the start up process I use a bash scrip in the cont-init.d directory to check the validity of the database endpoint. The relevant part of the script is:

    # check for the database endpoint for 30 seconds
    echo " "
    echo "**** Checking DB endpoint ****"
    source .env
    END=$((SECONDS+30))
    while [ ${SECONDS} -lt ${END} ] && [ "${DB_HOST} ${DB_PORT}" ];
        do
        /usr/bin/nc -z ${DB_HOST} ${DB_PORT} && 
        if [ ! -z "$(/usr/bin/nc -w1 ${DB_HOST} ${DB_PORT})" ];
            then
            [ ! -z "${RUN}" ] && break
            RUN="RAN"
            # we sleep here again due to first run init on DB containers
            [ ! -f /dbwait.lock ] && sleep 5
        else
            sleep 1
        fi
        sleep 1
    done

This seems to work in that it checks to ensure the db is accessible and then moves on. However, the output in my docker log is this:

    **** Checking DB endpoint ****
/var/run/s6/etc/cont-init.d/50-config: line 136: warning: command substitution: ignored null byte in input

/var/run/s6/etc/cont-init.d/50-config: line 136: warning: command substitution: ignored null byte in input

How can I either fix what is causing this warning or at least suppress the message?

Source: Docker Questions