Open
Description
Describe the problem
We rely on the /docker-entrypoint-initdb.d
directory to run a script to initialize some databases, and we've run into some inconsistent behavior with start-single-node
wherein the scripts under that directory don't get run if COCKROACH_USER
isn't set. It seems like it's because the entrypoint is opening an interactive cockroach sql
session which blocks execution of the scripts under /docker-entrypoint-initdb.d
.
I'm wondering if opening an interactive cockroach sql
session is intended behavior, or an unintentional result of calling run_sql_query
without any query arguments here.
To Reproduce
echo 'CREATE DATABASE IF NOT EXISTS "hello_world";' > init-db.sql
docker run \
-ti \
--rm \
-v $PWD/init-db.sql:/docker-entrypoint-initdb.d/init-db.sql \
-p 26257:26257 \
cockroachdb/cockroach:v23.1.10 \
start-single-node --insecure
Expected behavior
A single node instance is started up and the "hello_world" database exists.
Jira issue: CRDB-31707