Created
September 5, 2016 09:17
-
Star
(154)
You must be signed in to star a gist -
Fork
(25)
You must be signed in to fork a gist
-
-
Save onjin/2dd3cc52ef79069de1faa2dfd456c945 to your computer and use it in GitHub Desktop.
example docker compose for postgresql with db init script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
postgres: | |
image: postgres:9.4 | |
volumes: | |
- ./init.sql:/docker-entrypoint-initdb.d/init.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table sometable(id int); |
I'm running into an issue where my db init process is in fact running in the container, at least batching a bunch of CREATES and INSERTS of my dump data, but then is abruptly shut down and restarted.
strends_psql | CREATE DATABASE strends_psql | You are now connected to database "rivers" as user "usr". strends_psql | CREATE SCHEMA strends_psql | SET strends_psql | SET strends_psql | SET strends_psql | SET strends_psql | SET strends_psql | SET strends_psql | SET strends_psql | CREATE TABLE strends_psql | INSERT 0 4 strends_psql | strends_psql | strends_psql | 2019-04-29 17:43:06.633 UTC [41] LOG: received fast shutdown request strends_psql | waiting for server to shut down....2019-04-29 17:43:06.637 UTC [41] LOG: aborting any active transactions
When I get a shell into my db container, the database
rivers
was created but is empty, with no tables, relations, or data from my batched inserts.
The same issue
I'm running into an issue where my db init process is in fact running in the container, at least batching a bunch of CREATES and INSERTS of my dump data, but then is abruptly shut down and restarted.
strends_psql | CREATE DATABASE strends_psql | You are now connected to database "rivers" as user "usr". strends_psql | CREATE SCHEMA strends_psql | SET strends_psql | SET strends_psql | SET strends_psql | SET strends_psql | SET strends_psql | SET strends_psql | SET strends_psql | CREATE TABLE strends_psql | INSERT 0 4 strends_psql | strends_psql | strends_psql | 2019-04-29 17:43:06.633 UTC [41] LOG: received fast shutdown request strends_psql | waiting for server to shut down....2019-04-29 17:43:06.637 UTC [41] LOG: aborting any active transactions
When I get a shell into my db container, the database
rivers
was created but is empty, with no tables, relations, or data from my batched inserts.The same issue
Same problem aswell
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I followed this thread and figured out the docker-compose.yml which works. But when I am trying to create a new database or access the table created, or the table's data, I see no output nor any error. It's just new database didn't get created, new table didn't get created. (I tried to connect to the database using
docker exec -it containerId bash
, thenpsql -h <hostname> -p <port> -U <username> -d <database>
)Surprisingly, when I do the GET operation from my codebase, it works to retrieve the inserted data. Is this expected or Am I missing something?