docker-postgresql icon indicating copy to clipboard operation
docker-postgresql copied to clipboard

allow creating user with no password

Open CzechJiri opened this issue 9 years ago • 1 comments

function create_user exits when no password is supplied, in some cases it might be useful to create user with random long password e.g. when PG_TRUST_LOCALNET is enabled

random password can be generated for example using openssl random function

DB_PASS=$(openssl rand -base64 32)

CzechJiri avatar Jun 06 '16 18:06 CzechJiri

You can do this in your Dockerfile, example:

FROM sameersbn/postgresql

RUN bash -l -c 'echo export PG_PASSWORD="$(openssl rand -base64 32)" >> /etc/bash.bashrc'

Or via your docker run command:

docker run ---env PG_PASSWORD="$(openssl rand -base64 32)" .......

LongLiveCHIEF avatar Oct 30 '16 19:10 LongLiveCHIEF