Host replication all ::1/128 scram-sha-256 # Allow replication connections from localhost, by a user with the Password_encryption = scram-sha-256 # md5 or scram-sha-256 I tried to change my password_encryption to scram-sha256 in nf file, and changed pg_hba.conf METHOD to scram-sha-256 as well, you can see the changes in the configuration below: # - Authentication. docker-compose: If you need to specify the environment variable in docker-compose.yml, specify as below.I'm using postgresql and as part of learning, I tried to change to login methods to have a more secure login methods.Please refer documentation for more details here Dockerfile: If you need to specify the environment variable in Dockerfile, specify as mentioned below.Please refer documentation for more details hereĭocker run -e POSTGRES_PASSWORD=secrect -e POSTGRES_USER=postgres image/name Run Image: If running docker image directly, use below to include environment variable in docker run with -e K=V.It allows user to specify the environment variables for the below ones and these can be easily overridden at run time.Įnvironment variables can be overridden using below three methods depending on your case. If you look at the official postgres image for complete information. Not sure which postgres image are you using. RUN mkdir -p /var/run/postgresql & chown -R postgres /var/run/postgresqlĮNV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH RUN mv -v /usr/share/postgresql/$PG_MAJOR/ /usr/share/postgresql/ \ # make the sample config easier to munge (and "correct by default") Postgresql-contrib-$PG_MAJOR=$PG_VERSION \ *$/\1 = false/' /etc/postgresql-common/nf \ RUN echo 'deb jessie-pgdg main' $PG_MAJOR > /etc/apt//pgdg.list RUN apt-key adv -keyserver ha. -recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8 & localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 RUN apt-get update & apt-get install -y locales & rm -rf /var/lib/apt/lists/* \ # make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default & apt-get purge -y -auto-remove ca-certificates wget & rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \ & gpg -batch -verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \ & wget -O /usr/local/bin/gosu.asc "$GOSU_VERSION/gosu-$(dpkg -print-architecture).asc" \ & wget -O /usr/local/bin/gosu "$GOSU_VERSION/gosu-$(dpkg -print-architecture)" \ & apt-get update & apt-get install -y -no-install-recommends ca-certificates wget & rm -rf /var/lib/apt/lists/* \ RUN groupadd -r postgres -gid=999 & useradd -r -g postgres -uid=999 postgres Here is a copy of the base postgres Dockerfile below. I was assuming in the base postgres Dockerfile, there would be some instruction to set the database name, username and password. I'm not able to follow however, where those credentials are being set in the first place. My question is when is the postgres user and password being set? If I run this docker-compose everything works, meaning the web app can pass credentials to the postgres database and establish a connection. You will notice there is a env_file containing: DB_NAME=postgres I have everything up and running, but there are a few things going on that I'm not able to follow or understand.Ĭommand: /usr/local/bin/gunicorn docker_gi:application -w 2 -b :8000
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |