Given:
Linux Ubuntu 22.04
I want to download Docker image - Postgres:9.6.24 and create my database and show list of tables in my db.
So, steps:
Dowanload image from Docker hub:
docker run postgres:9.6.24 -e POSTGRES_PASSWORD=mypass -p 5432:5432
But I get error:
Here output:
docker run postgres:9.6.24 -e POSTGRES_PASSWORD=mypass -p 5432:5432
Unable to find image 'postgres:9.6.24' locally
9.6.24: Pulling from library/postgres
1cb79db8a9e7: Already exists
f6bae7873dd7: Already exists
8f7722dc50a7: Already exists
e8622b8cb6f3: Already exists
d6d74bba3a57: Already exists
874d4d2a09fd: Already exists
2d87c3a4038c: Already exists
f955a6cf127b: Already exists
f62dc55c568d: Already exists
4e2c4902efbd: Already exists
01c676df543a: Already exists
1e3d335ef0b7: Already exists
11087f2b0d87: Already exists
4b9a74ac6ea0: Already exists
Digest: sha256:caddd35b05cdd56c614ab1f674e63be778e0abdf54e71a7507ff3e28d4902698
Status: Downloaded newer image for postgres:9.6.24
Error: Database is uninitialized and superuser password is not specified.
You must specify POSTGRES_PASSWORD to a non-empty value for the
superuser. For example, "-e POSTGRES_PASSWORD=password" on "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