1

I have created a Postgresql docker image using the following command on Windows:

docker run --name airdb-postgres -e POSTGRES_PASSWORD=post1234 -d -p 5432:5432 postgres:alpine

is it possible to change the password I assigned to it, or I should create a new one by disposing this image?

brainoverflow
  • 609
  • 1
  • 8
  • 19
  • 1
    Name of the environment variable is `PGPASSWORD` not `POSTGRES_PASSWORD` (of course provided that there is already a user with this password). However can you please elaborate on what exactly you are trying to do? – mic4ael Oct 31 '19 at 13:02
  • I wasn't sure how it is possible to change the password of a postgresql docker image. I realized I can do it after logging into the container @mic4ael . – brainoverflow Oct 31 '19 at 14:30

1 Answers1

8

You should be able to do that by logging into the container docker exec -it <container_id> bash, then use psql cli to change the password.

See How to change PostgreSQL user password? for the latter part.

msrc
  • 503
  • 1
  • 5
  • 16