I am using the official PostgreSQL Docker image ( postgresql:11-alpine ) from Docker HUB registry.
I want to create the PostgreSQL administrator password in a safe way.
Currently, this image offer to set it using environment variable :
Using environment variables is not really safe as it can be seen after initialization by anyone having access to the host.
There is another option for setting the password but that only work in docker swarm.
In this image, how can I set the PostgreSQL administrator, securely, and without manual step during initial deployment?
One quick suggestion will be
Use the environment variable password and then Bash into container and change the password using
postgres=# \password
Enter new password:
Enter it again:
postgres=#
Or Create a Docker FILE which does
Get the Image RUN with ENVIRONMENT password Bash into and change the pwd via initialization script
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.