Hello KodeKloud Team,
Currently, i am going through the topic named - Docker Training Course for the Absolute Beginner and under the section - Demo – Example Voting Application - where you have simply asked to deploy the postgres DB container without any environment variable, Now if i run any postgres container without giving any POSTGRES_PASSWORD environment variable, it exits immediately. PFA the error -
[email protected]:~# docker run --name=db postgres:9.4
Error: Database is uninitialized and superuser password is not specified.
You must specify POSTGRES_PASSWORD for the superuser. Use
“-e POSTGRES_PASSWORD=password” to set it in “docker run”.
You may also use POSTGRES_HOST_AUTH_METHOD=trust to allow all connections without a password. This is *not* recommended. See PostgreSQL documentation about "trust": https://www.postgresql.org/docs/current/auth-trust.html
Hence, password should be specified while deploying the postgres container.
– i have gone through the code of worker-node and in the code - postgres is the password used in the code.
so we should deploy the container for DB -
docker run -d --name=db -e POSTGRES_PASSWORD=postgres postgres:9.4
After creating the DB container with password = ‘postgres’, worker and result container works perfectly fine,…!