function waitForDB( spinner ) {
	if ( spinner ) {
		spinner.start( 'Waiting for MariaDB...' );
	} else {
		console.log( 'Waiting for MariaDB...' );
	}

	return new Promise( ( resolve ) => {
		const interval = setInterval( () => {
			const netcat = new nc();

			netcat.address( '127.0.0.1' );
			netcat.port( 3306 );
			netcat.connect();
			netcat.on( 'data', function(  ) {
				netcat.close();

				if ( spinner ) {
					spinner.succeed( 'MariaDB has started...' );
				}

				clearInterval( interval );
				resolve();
			} );
		}, 1000 );
	} );
}
Wait for MariaDB to come up and finish initializing.

The first the time the MariaDB container starts it will initialize the data directory. It will open port 3306
but not send data back when connected to, instead closing the connection immediately. netcat is used
here to connect the the MariaDB port and will resolve the promise once MariaDB sends data back indicating
MariaDB is ready for work.