jdaarevalo / docker_postgres_with_data

165 stars 89 forks source link

Tables are not created #6

Open marcosflobo opened 1 year ago

marcosflobo commented 1 year ago

Hello,

Running your docker-compose resulting that there is no tables created. Captura de pantalla de 2023-03-25 17-10-50

The log I get from the docker-compose does raise an error only when I try a query:

$ docker-compose up
Creating network "docker_default" with the default driver
Creating docker_postgres_1 ... done
Attaching to docker_postgres_1
postgres_1  | The files belonging to this database system will be owned by user "postgres".
postgres_1  | This user must also own the server process.
postgres_1  | 
postgres_1  | The database cluster will be initialized with locale "en_US.utf8".
postgres_1  | The default database encoding has accordingly been set to "UTF8".
postgres_1  | The default text search configuration will be set to "english".
postgres_1  | 
postgres_1  | Data page checksums are disabled.
postgres_1  | 
postgres_1  | fixing permissions on existing directory /var/lib/postgresql/data ... ok
postgres_1  | creating subdirectories ... ok
postgres_1  | selecting default max_connections ... 100
postgres_1  | selecting default shared_buffers ... 128MB
postgres_1  | selecting dynamic shared memory implementation ... posix
postgres_1  | creating configuration files ... ok
postgres_1  | running bootstrap script ... ok
postgres_1  | performing post-bootstrap initialization ... ok
postgres_1  | syncing data to disk ... 
postgres_1  | WARNING: enabling "trust" authentication for local connections
postgres_1  | You can change this by editing pg_hba.conf or using the option -A, or
postgres_1  | --auth-local and --auth-host, the next time you run initdb.
postgres_1  | ok
postgres_1  | 
postgres_1  | Success. You can now start the database server using:
postgres_1  | 
postgres_1  |     pg_ctl -D /var/lib/postgresql/data -l logfile start
postgres_1  | 
postgres_1  | waiting for server to start....2023-03-25 16:01:31.797 UTC [42] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres_1  | 2023-03-25 16:01:31.818 UTC [43] LOG:  database system was shut down at 2023-03-25 16:01:31 UTC
postgres_1  | 2023-03-25 16:01:31.825 UTC [42] LOG:  database system is ready to accept connections
postgres_1  |  done
postgres_1  | server started
postgres_1  | 
postgres_1  | /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/create_tables.sql
postgres_1  | CREATE TABLE
postgres_1  | CREATE TABLE
postgres_1  | CREATE TABLE
postgres_1  | CREATE TABLE
postgres_1  | CREATE TABLE
postgres_1  | CREATE TABLE
postgres_1  | CREATE TABLE
postgres_1  | CREATE TABLE
postgres_1  | 
postgres_1  | 
postgres_1  | /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/fill_tables.sql
postgres_1  | SET
postgres_1  | SET
postgres_1  | SET
postgres_1  | SET
postgres_1  | SET
postgres_1  | SET
postgres_1  | SET
postgres_1  | SET
postgres_1  | SET
postgres_1  | CREATE EXTENSION
postgres_1  | INSERT 0 100
postgres_1  | INSERT 0 100
postgres_1  | INSERT 0 30
postgres_1  | INSERT 0 100
postgres_1  | INSERT 0 100
postgres_1  | INSERT 0 5
postgres_1  | INSERT 0 100
postgres_1  | INSERT 0 100
postgres_1  | 
postgres_1  | 
postgres_1  | 2023-03-25 16:01:32.079 UTC [42] LOG:  received fast shutdown request
postgres_1  | waiting for server to shut down....2023-03-25 16:01:32.082 UTC [42] LOG:  aborting any active transactions
postgres_1  | 2023-03-25 16:01:32.088 UTC [42] LOG:  worker process: logical replication launcher (PID 49) exited with exit code 1
postgres_1  | 2023-03-25 16:01:32.089 UTC [44] LOG:  shutting down
postgres_1  | 2023-03-25 16:01:32.130 UTC [42] LOG:  database system is shut down
postgres_1  |  done
postgres_1  | server stopped
postgres_1  | 
postgres_1  | PostgreSQL init process complete; ready for start up.
postgres_1  | 
postgres_1  | 2023-03-25 16:01:32.199 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
postgres_1  | 2023-03-25 16:01:32.199 UTC [1] LOG:  listening on IPv6 address "::", port 5432
postgres_1  | 2023-03-25 16:01:32.204 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres_1  | 2023-03-25 16:01:32.221 UTC [69] LOG:  database system was shut down at 2023-03-25 16:01:32 UTC
postgres_1  | 2023-03-25 16:01:32.231 UTC [1] LOG:  database system is ready to accept connections
postgres_1  | 2023-03-25 16:09:57.565 UTC [89] ERROR:  relation "product" does not exist at character 15
postgres_1  | 2023-03-25 16:09:57.565 UTC [89] STATEMENT:  select * from product

Would have any idea what's not working for me?

Thanks!

karthickthangasamy commented 11 months ago

@marcosflobo Myself also facing this issue. Did you resolve it?

HarrisonCheng commented 10 months ago

It might have to do with the docker image version. I had the same issue and solved it by using the latest tag instead of 10.5.