A #postgresql user today asked:
noob question - trying to write a Dockerfile that runs postgres... how do I get the effect of a non-interactive `service postgresql initdb` call?
/usr/lib/postgresql/9.5/bin/initdb data -A md5 --pwfile=pwfile 2>&1 > /dev/null
The above says:
- Initialize a new data directory called data.
- Use the auth method of md5 to start
- Tell initdb to get the password for md5 from the password file of pwfile
- Redirect STDERR to STDOUT and then write that output to /dev/null
This will produce zero output on execution. You could still have for a RETVAL to see if it suceeded or change /dev/null to a log file.